Statement: This article is original to the author, and the reprinter must indicate it.
Author: Zeng Jin (qq:310575)
Recently I have been busy testing the company's BI software performance. These days I mainly test the concurrency and stability of PA when CUBE uses ROLAP.
Involving tables and dimensions, cube: fact table sales_fact_1997, dimension table time_by_day; cube: sales
Modification content: Delete the original TIME dimension, create a new TIME dimension, and modify the SALES cube.
Data insertion:
1. Fact data insertion: copy the data of sales_fact_1997 through DTS and scheduling. The frequency is 10,000 messages per minute.
Mainly used SQL statements: select top 10000 * from sales_fact_1997
2. Dimension data insertion: Insert data into time_by_day through SQL statements.
SQL statements used in the test:
1. Single insert
INSERT INTO time_by_day
(time_id, the_date, the_year, month_of_year, quarter,day_of_month)
VALUES ('1101', '1999-10-1', '1999', '10', 'Q4','1')
2. Single insertion:
INSERT INTO time_by_day
(time_id, the_date, the_year, month_of_year, quarter, day_of_month)
SELECT TOP 1 time_id + 1 AS time_id, the_date + 1 AS the_date, YEAR(the_date + 1)
AS the_year, MONTH(the_date + 1) AS month_of_year, { fn QUARTER(the_date + 1)
} AS quarter, DAY(the_date + 1) AS day_of_month
FROM time_by_day
ORDER BY time_id DESC
3. Loop insertion:
DECLARE @MyCounter INT
SET @MyCounter = 0 /*Set variables*/
WHILE (@MyCounter < 2) /*Set the number of loops*/
BEGIN
WAITFOR DELAY '000:00:10' /*Delay time 10 seconds*/
INSERT INTO time_by_day
(time_id, the_date, the_year, month_of_year, quarter, day_of_month)
SELECT TOP 1 time_id + 1 AS time_id, the_date + 1 AS the_date, YEAR(the_date + 1)
AS the_year, MONTH(the_date + 1) AS month_of_year, { fn QUARTER( the_date + 1)
} AS quarter, DAY(the_date + 1) AS day_of_month
FROM time_by_day
ORDER BY time_id DESC
SET @MyCounter = @MyCounter + 1
END
4. Insert data with time as variable
DECLARE @MyCounter INT
declare @the_date datetime
SET @MyCounter = 0
SET @the_date = '1999-1-4'
WHILE (@MyCounter < 200000)
BEGIN
WAITFOR DELAY '000:00:10'
/*INSERT INTO time_by_day
(time_id, the_date , the_year, month_of_year, quarter, day_of_month)
SELECT TOP 1 time_id + 1 AS time_id, the_date + 1 AS the_date, YEAR(the_date + 1)
AS the_year, MONTH(the_date + 1) AS month_of_year, { fn QUARTER(the_date + 1)
} AS quarter, DAY(the_date + 1) AS day_of_month
FROM time_by_day
ORDER BY time_id DESC
*/
insert into time_by_day (time_id,the_date)values('371',@the_date)
SET @the_date = @the_date + 1
SET @MyCounter = @ MyCounter + 1
END