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
Revise FINAL processing documentation with settings update
Updated settings reference and performance tuning sections for FINAL processing with skip indexes. Added details on related settings and their defaults since various versions.
Copy file name to clipboardExpand all lines: content/en/altinity-kb-queries-and-syntax/altinity-kb-final-clause-speed.md
+15-21Lines changed: 15 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,17 +22,6 @@ description: >
22
22
* Since 25.12 - `apply_prewhere_after_final` and `apply_row_policy_after_final` settings for correct PREWHERE/row policy handling with FINAL
23
23
* Since 26.2 - `enable_automatic_decision_for_merging_across_partitions_for_final=1` by default (auto-enables cross-partition optimization when safe)
24
24
25
-
### Related Settings
26
-
27
-
| Setting | Default | Since | Description |
28
-
|---------|---------|-------|-------------|
29
-
|`do_not_merge_across_partitions_select_final`| 0 | 20.10 | Skip cross-partition merging when partitions are pre-optimized |
30
-
|`max_final_threads`| 0 (auto) | 20.5 | Thread limit for FINAL processing |
31
-
|`enable_vertical_final`| 1 | 24.1 | Read columns in parallel from different parts |
32
-
|`use_skip_indexes_if_final`| 1 | 25.6 | Allow skip indexes with FINAL |
33
-
|`use_skip_indexes_if_final_exact_mode`| 1 | 25.6 | Rescan newer parts to ensure correctness with skip indexes |
34
-
|`apply_prewhere_after_final`| 0 | 25.12 | Apply PREWHERE after deduplication (needed when PREWHERE references non-PK columns) |
35
-
|`enable_automatic_decision_for_merging_across_partitions_for_final`| 1 | 26.2 | Auto-enable `do_not_merge_across_partitions_select_final` when partition key is in PK |
36
25
37
26
### Partitioning
38
27
@@ -109,6 +98,8 @@ SELECT count() FROM repl_tbl FINAL WHERE NOT ignore(*)
109
98
110
99
```
111
100
101
+
Since 26.2, `enable_automatic_decision_for_merging_across_partitions_for_final=1` (default) auto-enables this when partition key columns are included in PRIMARY KEY
102
+
112
103
### Light ORDER BY
113
104
114
105
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.
@@ -156,16 +147,19 @@ Use these settings when needed:
156
147
157
148
Example problem: if you have `ReplacingMergeTree` with a `deleted` column and PREWHERE filters on it, without `apply_prewhere_after_final=1` you may get wrong results because PREWHERE sees rows before FINAL picks the winner.
158
149
159
-
### Performance Tuning
150
+
### FINAL with skip indexes:
151
+
- Both `use_skip_indexes_if_final` and `use_skip_indexes_if_final_exact_mode` are enabled by default since 25.6
152
+
- Skip indexes on PRIMARY KEY columns have lower overhead (no extra rescan needed since 26.1), see [https://github.com/ClickHouse/ClickHouse/pull/78350](https://github.com/ClickHouse/ClickHouse/pull/78350)
160
153
161
-
**For wide tables (many columns):**
162
-
-`enable_vertical_final=1` (default) reads only needed columns in parallel
163
-
- Ensure `max_final_threads` is not set to 1
164
154
165
-
**For partitioned tables:**
166
-
- Use `do_not_merge_across_partitions_select_final=1` when partitions are pre-optimized
167
-
- Since 26.2, `enable_automatic_decision_for_merging_across_partitions_for_final=1` (default) auto-enables this when partition key columns are included in PRIMARY KEY
155
+
### Settings reference
168
156
169
-
**For tables with skip indexes:**
170
-
- Both `use_skip_indexes_if_final` and `use_skip_indexes_if_final_exact_mode` are enabled by default since 25.6
171
-
- Skip indexes on PRIMARY KEY columns have lower overhead (no extra rescan needed since 26.1), see [https://github.com/ClickHouse/ClickHouse/pull/78350](https://github.com/ClickHouse/ClickHouse/pull/78350)
157
+
| Setting | Default | Since | Description |
158
+
|---------|---------|-------|-------------|
159
+
|`do_not_merge_across_partitions_select_final`| 0 | 20.10 | Skip cross-partition merging when partitions are pre-optimized |
160
+
|`max_final_threads`| 0 (auto) | 20.5 | Thread limit for FINAL processing |
161
+
|`enable_vertical_final`| 1 | 24.1 | Read columns in parallel from different parts |
162
+
|`use_skip_indexes_if_final`| 1 | 25.6 | Allow skip indexes with FINAL |
163
+
|`use_skip_indexes_if_final_exact_mode`| 1 | 25.6 | Rescan newer parts to ensure correctness with skip indexes |
164
+
|`apply_prewhere_after_final`| 0 | 25.12 | Apply PREWHERE after deduplication (needed when PREWHERE references non-PK columns) |
165
+
|`enable_automatic_decision_for_merging_across_partitions_for_final`| 1 | 26.2 | Auto-enable `do_not_merge_across_partitions_select_final` when partition key is in PK |
0 commit comments