Skip to content

Commit 70c0fd2

Browse files
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.
1 parent 67832a5 commit 70c0fd2

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

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

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ description: >
2222
* Since 25.12 - `apply_prewhere_after_final` and `apply_row_policy_after_final` settings for correct PREWHERE/row policy handling with FINAL
2323
* Since 26.2 - `enable_automatic_decision_for_merging_across_partitions_for_final=1` by default (auto-enables cross-partition optimization when safe)
2424

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 |
3625

3726
### Partitioning
3827

@@ -109,6 +98,8 @@ SELECT count() FROM repl_tbl FINAL WHERE NOT ignore(*)
10998

11099
```
111100

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+
112103
### Light ORDER BY
113104

114105
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:
156147

157148
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.
158149

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)
160153

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
164154

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
168156

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

Comments
 (0)