Repository navigation
Conversation
396b050 to
b0fb1c5
Compare
This reverts commit e1d61935c802625c11554e74067c7c1145a27dd5.
This reverts commit 6cfef2483258adb9deda98b0b50f1847e3e8249e.
This reverts commit db8a10c0e5568244f0f9de9d86a1cf2698c7d1f9.
|
Hi @KochetovNicolai, could you help review this PR thanks. |
|
Workflow [PR], commit [ab689bc] Summary: ✅
AI ReviewSummaryThis PR lets ungrouped, argument-free Final VerdictStatus: ✅ Approve |
Preserve unknown counts through part loading and mutations, respect `apply_deleted_mask`, and keep extrema and empty-input semantics correct. Related: ClickHouse#78271
Preserve mutation-snapshot guards, aggregate matching, and projection diagnostics. Adapt `readRows` to the current `MutableColumns` interface while retaining exact-count validation. Related: ClickHouse#78271
Enable `optimize_use_projections` and `optimize_use_implicit_projections` explicitly so CI randomized settings cannot disable the optimization being asserted. Use exact query text in `system.query_log` to avoid matching the inspection queries and returning multiple rows from the scalar subquery. Validated against the PR CI binary: both original failures reproduced; 41 post-fix runs passed, including 31 recorded CI setting combinations. One truncated combination could not be replayed; parallel-replica cases used a single-node loopback cluster. Related: ClickHouse#78271 CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=78271&sha=b31f98a09522dbd3274d7cdad3dcf0346f508b82&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Require empty aggregate arguments when relaxing the lightweight-delete projection guard. Preserve expression evaluation and exceptions for `count(expr)` without changing the existing non-lightweight-delete or granule-count paths. Add functional coverage for `Wide` and `Compact` parts, throwing arguments, count normalization, `Nullable` values, and empty visible input. The unmodified new test exposes four missing exceptions on the pre-fix PR CI binary; scan-path controls match the reference. The new C++ restriction still requires CI build validation. Related: ClickHouse#78271 Review: ClickHouse#78271 (comment)
Include the replacement of the remaining `FifoQueue` reference with `RequestQueue` and the updated serialization fuzzer setting. Preserve the lightweight-delete count optimization and its regression tests. Related: ClickHouse#124798 Related: ClickHouse#78271 CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=78271&sha=4be83ae0c641cc6ad1e9eb286f9f0f2a40bee698&name_0=PR&name_1=Build%20%28arm_tidy%2C%202%2F4%29
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units13 translation units recompiled, 118 s compile time in total, 13 of them have a recent master baseline. |
Use three fixed 32-row granules and 80 rows for `Wide` parts, and 100 rows for the `Compact` part lifecycle checks. Preserve deleted extrema, exact-range boundaries, settings changes, reloads, and all forced projection assertions. The recorded CI settings pass locally before and after the change. The reduced test passed three replays in 1.46-1.66 seconds; the original took 2.12 seconds. The 264.97-second CI timeout was not reproduced locally. Related: ClickHouse#78271 CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=78271&sha=6bdd5ab22238a2d8ae0e11967860d3e3297ff2a5&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Include the upstream rollback of the AWS SDK upgrade associated with the `aws_common_private_has_avx2` TSan reports. Preserve the count-projection fixes and reduced regression-test workload. Related: ClickHouse#125030 Related: ClickHouse#78271 CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=78271&sha=6bdd5ab22238a2d8ae0e11967860d3e3297ff2a5&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%20targeted%29
|
🕵 Hi @alexey-milovidov, could you please review this PR, or suggest someone familiar with MergeTree projection optimization who could take a look? It speeds up bare |
|
🕵 Hi @KochetovNicolai, could you please review this PR, or point us to the right maintainer? It enables metadata-only bare |
Adapt `readExistingRowsCount` to both mutable and shared `readRows` outputs, keeping mask-read errors explicit. Preserve the upstream storage-type-change guard together with deletion-mask invalidation when reusing `existing_rows_count`. Related: ClickHouse#78271
Keep the upstream candidate list passed to `getAggregateProjectionCandidates`, including hypothetical projections for `EXPLAIN WHATIF`. Preserve the argument-free count restriction and lightweight-delete guards without rebuilding or shadowing that list. Related: ClickHouse#78271
|
🕵 Hi @CurtizJ, could you please review this PR? Thanks! |
Lightweight deletes leave physical rows in a part and hide them with
_row_exists. Metadata-only counting is currently disabled for these parts, even when an exact live-row count has already been calculated for merge-size estimation. Reuse that count through the implicit_minmax_count_projectionso eligibleSELECT count() FROM tablequeries do not need to scan the data or deletion masks.The optimization is deliberately limited to ungrouped, argument-free
counton lightweight-delete parts. It does not enable metadata answers formin,max, orcount(expr), and it keeps the guard against granule-based counting over deletion masks. Filters must still be computable by the implicit projection; this is not a shortcut for arbitrary filtered counts.To make the reused counts safe for query results:
existing_rows_countas either exact or unknown (std::nullopt), rather than substituting the physical row count when it was not calculated.apply_deleted_mask = 0by using physical row counts, and preserve empty-input semantics when all visible rows have been deleted.The existing
exclude_deleted_rows_for_part_size_in_mergesetting enables counting during lightweight-delete mutations. Together withload_existing_rows_count_for_old_parts, it also enables calculating counts when loading existing parts; this can increase table-loading I/O. Implicit projection optimization must be enabled. No setting defaults or on-disk formats are changed.Functional coverage includes
WideandCompactparts, deleted extrema, primary-key range filters, settings changes, mixed known/unknown counts, part reloads, row-removing mutations, empty inputs, and exceptions from count arguments. The focused 20,000-row test returns the same count (19999) while reducingread_rowsfrom20000to1when exact live-row counts are available. This read-volume reduction was also verified with a PR CI binary in Docker; it is not an elapsed-time speedup claim.Related: #47930
Related: #66699
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Speed up ungrouped
countqueries onMergeTreetables with lightweight deletes when exact live-row counts are available, by reusing those counts through implicit projections instead of scanning the parts.Workflow [PR]
Sync PR [sync-upstream/pr/78271]