Skip to content

Add SUMMARY index benchmark for where() queries - #800

Open
tylrcc wants to merge 1 commit into
Blosc:mainfrom
tylrcc:bench/issue-652
Open

tylrcc wants to merge 1 commit into
Blosc:mainfrom
tylrcc:bench/issue-652

Conversation

@tylrcc

@tylrcc tylrcc commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #652.

examples/ctable/real_world.py shows CTable on real data, but nothing isolates what a SUMMARY index actually buys on a where() query. This adds a self-contained benchmark, bench/ctable/summary_index_perf.py, that runs the same selective range query three ways on a synthetic 3M-row CTable (no external dataset, runs right after install):

  1. no index — full scan;
  2. SUMMARY, chunk granularity — per-chunk min/max;
  3. SUMMARY, block granularity — per-block min/max.

It prints build time, rows scanned, matches, query time (best of 3), and speedup. "Rows scanned" is computed with the rule a SUMMARY index itself uses — a segment is scanned only when its [min, max] intersects the predicate — from the segment sizes of the stored column and the generated data, and the script comments say so. All three variants are asserted to return identical results.

Sample output (this machine):

VARIANT             BUILD (s)   ROWS SCANNED    MATCHES   TIME (s)  SPEEDUP
--------------------------------------------------------------------------
no index                0.000      3,000,000    299,999      0.011    1.00x
SUMMARY (chunk)         0.007      1,000,000    299,999      0.006    1.80x
SUMMARY (block)         0.057        312,500    299,999      0.004    2.79x

The header comments explain the trade-off (finer granularity skips more on clustered data but stores more metadata and builds slower) and note that the data is deliberately clustered, the favourable case for segment skipping.

Verification

Ran the script end-to-end against blosc2 4.15.0: it completes in a few seconds and the three variants agree on the match count (299,999). Each variant starts from create_summary_index=False so the only difference is the explicit index under test.

@FrancescAlted FrancescAlted left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks pretty good. I think the results would read better if you can make the datasets larger (~10x). Also, showing the space consumed by every kind of summary would be nice.

Bonus points: if you can use a real-world dataset like NYC or Chicago taxis or any other, that would be the cherry on the cake (but I know that this won't be easy).

@FrancescAlted

Copy link
Copy Markdown
Member

Ping?

This branch has not been deployed

No deployments
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.

[BENCH] Real-world query performance comparison

2 participants