Skip to content

Commit

Permalink
Update backfill-populate-mv-in-a-controlled-manner.md
Browse files Browse the repository at this point in the history
attach after finalize note
  • Loading branch information
BorisTyshkevich authored Jul 19, 2023
1 parent 04155cd commit 31348bf
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ WHERE toYYYYMM(ts) = 202105;

Actually, the first GROUP BY run will happen just before 1M rows will be stored on disk as a data part. You may disable that behavior by switching off [optimize_on_insert](https://clickhouse.com/docs/en/operations/settings/settings#optimize-on-insert) setting if you have heavy calculations during aggregation.

You may attach such a table (with AggregatingFunction columns) to the main table as in the example above, but if you don't like to have States in the aggregated table, data should be finalized and converted back to normal values. In that case, you have to move data by INSERT ... SELECT again:
You may attach such a table (with AggregatingFunction columns) to the main table as in the example above, but if you don't like having States in the Materialized Table, data should be finalized and converted back to normal values. In that case, you have to move data by INSERT ... SELECT again:

```sql
INSERT INTO MV
Expand All @@ -66,7 +66,7 @@ SELECT id,ts,v1,v2, -- nothing special for SimpleAggregatingFunction columns
from mv_import FINAL
```

The last run of GROUP BY will happen during FINAL execution and AggregatingFunction types converted back to normal values.
The last run of GROUP BY will happen during FINAL execution and AggregatingFunction types converted back to normal values. To simplify retries after failures an additional temporary table and the same trick with ATTACH could be applied.



Expand Down

0 comments on commit 31348bf

Please sign in to comment.