Skip to content

tp: use HLL cardinality estimates in query planner#5157

Draft
LalitMaganti wants to merge 1 commit intodev/lalitm/hll-computefrom
dev/lalitm/hll-integrate
Draft

tp: use HLL cardinality estimates in query planner#5157
LalitMaganti wants to merge 1 commit intodev/lalitm/hll-computefrom
dev/lalitm/hll-integrate

Conversation

@LalitMaganti
Copy link
Member

@LalitMaganti LalitMaganti commented Mar 17, 2026

Stack

Wire up Column::estimated_unique_count into the query planner's
equality filter row count estimation. When an HLL estimate is
available, use N/unique_count instead of the old N/(2*log2(N))
heuristic. This gives SQLite more accurate cost estimates, leading
to better join ordering.

Fix CUJ stdlib tables to use slice.id instead of ts for
row_number() ordering. slice.id is equivalent to ts ordering
(slices are inserted in ts order) but is resilient to ties when
multiple CUJs share the same timestamp.

Fix cpu_cycles_per_thread_slice diff test to add ORDER BY id
for deterministic output with LIMIT.
@github-actions
Copy link

🎨 Perfetto UI Builds

@LalitMaganti LalitMaganti marked this pull request as draft March 17, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant