Qd-tree: Learning Data Layouts for Big Data Analytics

Zongheng Yang, Badrish Chandramouli, Chi Wang, Johannes Gehrke, Yinan Li, Umar Farooq Minhas, Per-Åke Larson, Donald Kossmann, Rajeev Acharya

Introduction

In big data analytics, I/O latency remains the primary bottleneck for query performance. Modern database systems mitigate this through data skipping, where data is divided into blocks and indexed with "min-max" ranges. If a query's filters do not overlap with a block's range, the system skips that block entirely. However, traditional partitioning methods—like hashing or arrival-time sorting—often create "noisy" blocks, forcing systems to scan entire blocks for just a fraction of relevant records.

The qd-tree (query-data routing tree) addresses this by introducing a workload-aware data partitioning framework. By tailoring data layouts to specific query patterns, it maximizes skipping efficiency and achieves significant physical speedups.

System Architecture and Methods

The qd-tree is a binary tree structure where internal nodes represent predicates (cuts) in a high-dimensional data space, and leaves represent physical data blocks. The system consists of three main components: a Qd-tree Constructor, a Query Router, and a Data Router.

The qd-tree system architecture, illustrating the offline construction and online routing phases.

The paper proposes two construction strategies:

  1. Greedy Construction: A fast, top-down approach that selects the best immediate cut to maximize skipping. While efficient, it can struggle with complex disjunctive queries.
  2. Woodblock (Deep RL): A sophisticated approach using Proximal Policy Optimization (PPO). The RL agent learns to make strategic cuts that may not yield immediate benefits but lead to superior global skipping across the entire tree.

Key technical innovations include the use of semantic descriptions for every block, allowing for precise pruning, and the ability to handle complex predicates like categorical "IN" clauses and binary comparisons.

The "Aha" Moment: Why Reinforcement Learning?

A critical insight of the research is that greedy algorithms often fail on disjunctive queries (e.g., WHERE cpu < 10 OR cpu > 90). A greedy algorithm may see no immediate skipping benefit from isolating the cpu < 10 region and thus ignore the cut. In contrast, the RL agent recognizes the long-term value of these partitions.

Visualization of query workloads (Q1, Q2) in a 2D space, highlighting the challenges of disjunctive predicates.

Evaluation and Results

The authors evaluated the qd-tree using the TPC-H benchmark and real-world Microsoft internal datasets (ErrorLog-Int and ErrorLog-Ext).

  • I/O Reduction: On real-world datasets, qd-tree reduced the number of tuples accessed to as low as 0.2%, a massive improvement over standard range partitioning (100%) and previous state-of-the-art clustering (5-12%).
  • Physical Speedups: The system delivered 1.6x to 2.6x speedups on TPC-H and up to a 14x speedup on Spark-based error log workloads.
  • Efficiency: The Woodblock RL agent produced high-quality layouts in approximately 10-12 minutes, significantly faster than the 7+ hours required by traditional bottom-up clustering methods.

Limitations and Future Directions

While highly effective, the qd-tree currently assumes a relatively static workload. A radical shift in query patterns would necessitate a tree rebuild. Additionally, the current focus is on single-table optimization; extending this workload-aware partitioning to multi-table joins and exploring the physical cost of data re-organization ("cracking") are key areas for future research.

Summary updated

BibTeX
@inproceedings{yang2020qd,
  author = {Zongheng Yang and Badrish Chandramouli and Chi Wang and Johannes Gehrke and Yinan Li and Umar Farooq Minhas and Per-Åke Larson and Donald Kossmann and Rajeev Acharya},
  title = {{Qd-tree: Learning Data Layouts for Big Data Analytics}},
  booktitle = {SIGMOD},
  year = {2020},
  doi = {10.1145/3318464.3389770},
}
Figure