Skip to content

Commit bc6ebc2

Browse files
authored
Update tiflash-results-materialization.md (#15632) (#15692)
1 parent ba09667 commit bc6ebc2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tiflash/tiflash-results-materialization.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,21 @@ INSERT INTO detail_data(ts,customer_id,detail_fee) VALUES
103103
('2023-1-3 12:2:3', 'cus002', 2200.86),
104104
('2023-1-4 12:2:3', 'cus003', 2020.86),
105105
('2023-1-5 12:2:3', 'cus003', 1200.86),
106-
('2023-1-6 12:2:3', 'cus002', 20.86);
106+
('2023-1-6 12:2:3', 'cus002', 20.86),
107+
('2023-1-7 12:2:3', 'cus004', 120.56),
108+
('2023-1-8 12:2:3', 'cus005', 320.16);
109+
110+
-- Execute the following SQL statement 13 times to insert a cumulative total of 65,536 rows into the table.
111+
INSERT INTO detail_data SELECT * FROM detail_data;
107112
```
108113

109114
Save daily analysis results:
110115

111116
```sql
112-
SET @@tidb_enable_tiflash_read_for_write_stmt=ON;
117+
SET @@sql_mode='NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO';
113118

114119
INSERT INTO daily_data (rec_date, customer_id, daily_fee)
115-
SELECT DATE(ts), customer_id, sum(detail_fee) FROM detail_data WHERE DATE(ts) = CURRENT_DATE() GROUP BY DATE(ts), customer_id;
120+
SELECT DATE(ts), customer_id, sum(detail_fee) FROM detail_data WHERE DATE(ts) > DATE('2023-1-1 12:2:3') GROUP BY DATE(ts), customer_id;
116121
```
117122

118123
Analyze monthly data based on daily analysis data:

0 commit comments

Comments
 (0)