Skip to content

Commit 5239ef4

Browse files
Update altinity-kb-final-clause-speed.md
1 parent 6db71db commit 5239ef4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

content/en/altinity-kb-queries-and-syntax/altinity-kb-final-clause-speed.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ description: >
1717
* 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)
1818
* 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)
1919
* 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)
2121
* Since 25.6 - final supports Additional Skip Indexes, see [https://github.com/ClickHouse/ClickHouse/pull/78350](https://github.com/ClickHouse/ClickHouse/pull/78350)
2222

2323

2424
### Partitioning
2525

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.
2733

2834
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.
3235

3336
```sql
3437
DROP TABLE IF EXISTS repl_tbl;
@@ -95,7 +98,7 @@ SELECT count() FROM repl_tbl FINAL WHERE NOT ignore(*)
9598

9699
### Light ORDER BY
97100

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.
99102

100103
Example: UUID vs UInt64
101104
```

0 commit comments

Comments
 (0)