refactor: speed up the Parquet time-series read path #8
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
zoo/eve!8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "perf/tsdb-parquet-query"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Optimize the
eve_tsdb_parquetread path. Thetsdb querybenchmark (10,000 seeded rows,value=gt=5000, sort+date, limit 100) drops from ~8.45 ms to ~4.88 ms without changing the public API, query results or the on-disk format.Why it was slow
Timestamp(ms)was formatted to an RFC 3339 string for every scanned row.raw_pagesorted every matching row before applyingoffset/limit.Changes
table::DateMode::{Millis, Rfc3339}selects the representation; all internal reads (query, purge, export, compaction) useMillis, whilestore::decode_partkeepsRfc3339for the publicParquetCodeccontract.TableSchema::render_rowconverts only the returned page back to the canonical string.rows_to_batchalready accepts a numeric millisecond date, so purge/export/import/compaction are unchanged on disk.filter::sort_and_paginateusesselect_nth_unstable_byfor the firstoffset + limitrows and sorts only that prefix when the page does not cover the whole result; the original row index is the final tie-break, so equal keys keep the old stable order. No limit still uses a full sort.Op::Reon a numeric date renders it withformat_millisbefore matching.adr/parquet.mddocuments the millisecond read form and the partial selection.batch_to_rows,render_row, top-k pagination and tie order, date filters on the numeric read form, canonical dates after include/exclude and purge, and canonical dates after the 65-part compaction.Benchmark (same host, NATS + ClickHouse up,
cargo bench -p eve_e2e -- tsdb)tsdb query/parquettsdb query/clickhousetsdb purge/parquettsdb persistent projection/parquet/100tsdb insert/parquet/1000tsdb insert/parquet/1Parquet now answers this filtered/sorted page faster than ClickHouse (4.88 ms vs 6.16 ms); the insert gap remains unchanged and is dominated by ClickHouse's async-insert flush, not by this PR.
Verification
Not in this PR
Arrow compute kernels, projection pushdown (read only needed columns), parallel part scans, row-group pruning and precomputed lowercase sort keys remain possible follow-ups; this PR only removes the JSON/date round-trip and the full sort from the hot path.