You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/altinity-kb-queries-and-syntax/altinity-kb-final-clause-speed.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,18 +17,21 @@ description: >
17
17
* Since 23.9 - final doesn't read PK columns if unneeded ie only one part in partition, see [https://github.com/ClickHouse/ClickHouse/pull/53919](https://github.com/ClickHouse/ClickHouse/pull/53919)
18
18
* Since 23.12 - final applied only for intersecting ranges of parts, see [https://github.com/ClickHouse/ClickHouse/pull/58120](https://github.com/ClickHouse/ClickHouse/pull/58120)
19
19
* Since 24.1 - final doesn't compare rows from the same part with level > 0, see [https://github.com/ClickHouse/ClickHouse/pull/58142](https://github.com/ClickHouse/ClickHouse/pull/58142)
20
-
* Since 24.1 - final use vertical algorithm, (more cache friendly), see [https://github.com/ClickHouse/ClickHouse/pull/54366](https://github.com/ClickHouse/ClickHouse/pull/54366)
20
+
* Since 24.1 - final use vertical algorithm (more cache friendly), see [https://github.com/ClickHouse/ClickHouse/pull/54366](https://github.com/ClickHouse/ClickHouse/pull/54366)
21
21
* Since 25.6 - final supports Additional Skip Indexes, see [https://github.com/ClickHouse/ClickHouse/pull/78350](https://github.com/ClickHouse/ClickHouse/pull/78350)
22
22
23
23
24
24
### Partitioning
25
25
26
-
Right partition design could speed up FINAL processing.
26
+
Proper partition design could speed up FINAL processing.
27
+
28
+
For example, if you have a table with Daily partitioning, you can:
29
+
- After day end + some time interval during which you can get some updates run `OPTIMIZE TABLE xxx PARTITION 'prev_day' FINAL`
30
+
- or add table SETTINGS min_age_to_force_merge_seconds=86400,min_age_to_force_merge_on_partition_only=1
31
+
32
+
In that case, using FINAL with `do_not_merge_across_partitions_select_final` will be cheap or even zero.
27
33
28
34
Example:
29
-
1. Daily partitioning
30
-
2. After day end + some time interval during which you can get some updates - for example at 3am / 6am you do `OPTIMIZE TABLE xxx PARTITION 'prev_day' FINAL`
31
-
3. In that case using that FINAL with `do_not_merge_across_partitions_select_final` will be cheap.
32
35
33
36
```sql
34
37
DROPTABLE IF EXISTS repl_tbl;
@@ -95,7 +98,7 @@ SELECT count() FROM repl_tbl FINAL WHERE NOT ignore(*)
95
98
96
99
### Light ORDER BY
97
100
98
-
All columns specified in ORDER BY will be read during FINAL processing. Use fewer columns and lighter column types to create faster queries.
101
+
All columns specified in ORDER BY will be read during FINAL processing, creating additional disk load. Use fewer columns and lighter column types to create faster queries.
0 commit comments