Skip to content

Conversation

@mkmkme
Copy link
Collaborator

@mkmkme mkmkme commented Nov 6, 2025

Currently, all ranges in a query with FINAL clause on a ReplacingMergeTree table with is_deleted column have to be processed by FINAL merge transform.

Add a FilterTransform correspdoning to is_deleted = 0 for parts & ranges thus enabling parallel processing and skip FINAL Merge transform. The parts & ranges that qualify are 1) Partitions with only a single part when do_not_merge_across_partitions_select_final is True 2) Non-intersecting ranges identified by the existing split ranges into intersecting/non-intersecting optimization.

Performance example : ClickHouse#65180 (comment)

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

SELECT query with FINAL clause on a ReplacingMergeTree table with the is_deleted column now executes faster because of improved parallelization from 2 existing optimizations : 1) do_not_merge_across_partitions_select_final optimization for partitions of the table that have only a single part 2) Split other selected ranges of the table into intersecting / non-intersecting and only intersecting ranges have to pass through FINAL merging transform (ClickHouse#88090 by @shankar-iyer).

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All with Aarch64
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • Tiered Storage (2h)

shankar-iyer and others added 2 commits November 6, 2025 09:08
…with_filter

Optimize ReplacingMergeTree is_deleted FINAL queries by adding a filter expression transform
@mkmkme mkmkme added backport Backport 25.3 25.3.8 25.3.8 Altinity Stable labels Nov 6, 2025
Copy link

@ianton-ru ianton-ru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zvonand zvonand merged commit 61e2a75 into releases/25.3.8 Nov 7, 2025
385 of 394 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

25.3 25.3.8 25.3.8 Altinity Stable backport Backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants