Introduction
Traditional database indexing is typically a "pay-front" activity. Database administrators must anticipate which columns will be queried and invest significant time and computational resources into building static index structures before any queries are executed. Database Cracking emerged as a paradigm shift, allowing the database to partition data as a side effect of query processing—effectively "learning" the index incrementally.
The Problem: Workload Robustness
While original cracking is efficient for random workloads, it is "blinkered." It reorganizes data strictly at the boundaries specified by incoming queries. This leads to a significant performance "cliff" when faced with sequential workloads (e.g., querying val < 1, then val < 2, then val < 3). In such cases, the system performs expensive, near-full scans repeatedly because it only learns a marginal amount of information with each step. This lack of workload robustness makes standard cracking unreliable for exploratory data analysis where query patterns are unpredictable.
Methodology: Stochastic Partitioning
To address the lack of workload robustness, the authors propose moving from a purely query-driven approach to a stochastic (randomized) approach. By introducing "auxiliary" cracks—partitioning data at points other than those requested by the query—the system ensures more balanced data distribution regardless of the query sequence.
Key algorithms introduced include:
- DDR (Data Driven Random): Uses random pivots (similar to Quicksort) to partition data pieces. This is computationally efficient while providing excellent average-case partitioning.
- DD1R / DD1C: Lightweight variants that perform at most one auxiliary crack per query to minimize the "initialization penalty" for the first query in a workload.
- PMDD1R (Progressive): Limits the number of data "swaps" per query, spreading reorganization costs across the workload to maintain high responsiveness.
Experimental Evaluation
The approach was evaluated using two primary datasets:
- Synthetic Workloads: $10^8$ unique integers subjected to Random, Sequential, Skewed, and Periodic patterns.
- SkyServer (SDSS): A real-world 4TB astronomical dataset. The evaluation focused on the
Photoobjalltable (500 million tuples) using actual query logs that exhibit non-random, exploratory patterns.
Key Results
The experimental results demonstrate that stochastic cracking successfully mitigates the weaknesses of original cracking.
- Sequential Robustness: As shown in Figure 2(b) and 2(d), original cracking fails to improve performance on sequential workloads, matching the cost of a full scan. In contrast, stochastic cracking (the
Scrackvariant) is designed to match the performance of a fully pre-sorted index after a small number of queries by breaking the dependency on query boundaries. - Real-World Impact: On the SkyServer workload ($1.6 \times 10^5$ queries), original cracking required over 2,000 seconds. Stochastic cracking completed the same sequence in just 25 seconds.
- Efficiency: In random workloads (Figure 2a), stochastic variants add negligible overhead compared to original cracking, making them a safe default choice.
Conclusion
Stochastic database cracking provides a robust solution for adaptive indexing in main-memory column-stores. By using randomness as a shield against pathological query patterns, it ensures consistent performance across diverse workloads. Future research will focus on extending these techniques to disk-resident data and multi-attribute indexing.
Summary updated