OmniSketch: Multi-Dimensional Stream Synopsis
- OmniSketch is a streaming synopsis data structure that efficiently summarizes multi-dimensional, high-velocity data streams for OLAP-style queries with arbitrary conjunctive predicates.
- It combines Count-Min sketches with bottom-k minwise sampling to provide scalable, memory-efficient, and probabilistically accurate estimations while dynamically supporting filters on various attributes.
- Extensions of OmniSketch enable join cardinality estimation, offering significant throughput improvements and controlled error profiles over prior approaches such as Hydra in high-dimensional settings.
OmniSketch is a streaming synopsis data structure capable of efficiently summarizing multi-dimensional, high-velocity data streams for OLAP-style analytic queries with arbitrary conjunctive predicates. It provides a scalable, memory-efficient, and probabilistically accurate count-aggregate estimation over streams with multiple attributes, dynamically supporting filters on arbitrary subsets of attributes selected at query time, and extends to enable join cardinality estimation across tables in relational systems (Punter et al., 2023, Justen et al., 25 Aug 2025).
1. Motivation and Limitations of Prior Synopses
OmniSketch addresses key limitations of traditional streaming synopses—particularly Count-Min (CM) sketch and related structures—which primarily support aggregate queries over a single attribute and are intractable for general multi-attribute predicate queries. Handling predicates over attributes in standard approaches would require sketches or exponential per-update cost, which is prohibitive for even moderate values of (e.g., ). These approaches are also incapable of efficiently supporting queries with “don’t-care” attributes without incurring exponential space or computational blowup (Punter et al., 2023).
2. Data Structure Overview, Initialization, and Update
OmniSketch consists of independent attribute sketches, each adopting a two-level structure:
- An outer Count-Min sketch per attribute , comprising a array of cells (: depth, : width).
- Each cell 0 maintains:
- A counter 1,
- A minwise sample 2 (“bottom-3” hash values of record IDs), and
- The largest hash in the sample 4.
During initialization, for user-supplied error (5) and confidence (6), parameters are set as:
- 7,
- 8,
- 9,
- 0. Each cell’s sample has size 1.
For each new record arrival:
- For each attribute, and each row 2:
- Hash the attribute value to column 3, increment 4.
- Hash record ID to 5, maintain the 6 smallest such hashes in 7 (using red-black tree structures for 8 updates).
This construction ensures per-record update cost is 9, and total memory 0 (Punter et al., 2023).
3. Query Processing and Estimation Guarantees
To estimate the count of records matching a conjunction of 1 arbitrary predicates, for example:
2,
OmniSketch:
- Identifies, for each predicate, the corresponding cells in the attribute CM sketches.
- Computes, over all involved cells, the maximum counter 3.
- Intersects all corresponding bottom-4 samples to yield 5 of size 6.
- Returns estimator 7.
This process leverages two main sources of accuracy:
- Outer CM hashing bounds hash-collision false positives,
- Inner K-minwise samples yield an unbiased estimate of intersection size.
Theoretical guarantees (with properly chosen 8, 9, 0) state that with probability at least 1:
2
where 3 is the stream length. When the intersection sample 4 is too small, the estimator falls back to an upper bound with a controlled one-sided error (Punter et al., 2023).
4. Space, Time Complexity, and Parameterization
- Space complexity: For 5 attributes, space is 6 bits; more succinctly 7.
- Update cost: 8 per stream record.
- Query cost: 9 worst-case per query, but typically lower due to early pruning in intersection.
- Parameter selection: 0, 1, 2 maximized given memory 3. Increasing 4 lowers sampling error, increasing 5 mitigates collision error.
A quantitative trade-off is provided between memory, accuracy, and throughput. Empirical measurements confirm that, for up to 6 attributes, ingest throughput remains over 7 rec/s and accuracy is within the configured 8 across several real and synthetic datasets (Punter et al., 2023).
5. Comparison with Existing Approaches
Hydra, the prior state-of-the-art for multi-attribute stream synopses, maintains a single CM sketch with “universal” summaries in each cell, necessitating 9 update complexity per record. Experimentally, Hydra incurs both exponential update time (0 ms/update for 1) and exponential hash-collision errors for larger 2, rendering it impractical for high-velocity or high-dimensional streams.
OmniSketch achieves 3 per-update complexity, comparable or superior accuracy, and update throughput two to three orders of magnitude higher for 4. Error profiles remain stable under skew (e.g., Zipfian), and in range query settings, extension via a logarithmic number of dyadic CM sub-sketches yields range-count error at most 5 with negligible query-time overhead (Punter et al., 2023).
6. Extensions: Join Cardinality Estimation
The OmniSketch framework has been extended to support join cardinality estimation for cost-based query optimization in relational databases (Justen et al., 25 Aug 2025). It merges count-min sketches and K-minwise hashing to estimate multi-way join sizes, without uniformity or independence assumptions.
Join Cardinality Algorithms
- PK-Sample-Join: Samples primary-key side using OmniSketch, computes the inclusion probability 6, and for each sample, probes the foreign-key side. The overall join estimate is 7. This approach is sensitive to key-skew and composes poorly over multiple joins due to “witness loss.”
- Secondary Sketches: Constructs secondary OmniSketches on dimension tables, reprojecting fact-side samples onto the secondary sketch’s sample space, which enables a join over multiple tables to reduce to a single intersection of sample sets. This allows efficient join-cardinality estimation, especially in star schemas.
- Interoperability: All sketches use unified hash functions and root seeds, making probe and sample composition across tables possible.
- Acyclic Join Graphs: An algorithm, based on GYO-ear-removal, sequences probe and intersection steps to guarantee witness flow and correctness in α-acyclic join structures.
Empirical Evaluation
- On SSB-skew (star schema), secondary-sketch OmniSketch yields reductions of up to 8 in intermediate result sizes and speedups up to 9 in total execution times compared to DuckDB’s cost-based optimizer.
- On JOB-light (general schema), performance is mixed due to high foreign-key cardinalities and complex join graphs causing frequent fallback events.
- Core strength is in avoiding independence/uniformity assumptions, but performance degrades when compounded sampling probabilities become too small (Justen et al., 25 Aug 2025).
7. Practical Considerations and Future Directions
When deploying OmniSketch, practical parameter selection requires balancing memory constraints, target accuracy 0, and query throughput demands. Open challenges and extensions include:
- Deletions/turnstile streams: Possible with two-level/bottom-1 sketches; incurs modest update overhead.
- Very high dimensionality 2: Potentially addressed via adaptive attribute selection or hierarchical sketching.
- Skew adaptation: Detecting and reallocating buckets/samples for skewed attributes at runtime.
- Range queries: Supported via dyadic decomposition, with logarithmic space/time overhead per attribute.
A plausible implication is that OmniSketch generalizes efficiently to high-dimensional, heterogeneous streaming and relational-analytic workloads with minimal modification, provided that attribute-range domains and sampling scales remain within practical sketch-memory budgets (Punter et al., 2023, Justen et al., 25 Aug 2025).