Introduction
Traditional relational database management systems (RDBMS) are optimized for magnetic disk storage, where seek times are measured in milliseconds. However, as data volumes grow into the petabyte range, tertiary memory systems—such as tape libraries and optical disk jukeboxes—become necessary for cost-effective storage. In these environments, data access latencies can skyrocket to seconds or even minutes due to mechanical delays like tape loading and platter switching. This paper presents a novel approach to query execution that dynamically reorders data fetching to mitigate these massive latencies, achieving significant performance gains.
The Challenge of Tertiary Storage
Standard query optimizers generate fixed-order execution plans. While efficient for low-latency media, this rigidity is catastrophic for tertiary storage. If a query requires data from multiple tapes in a specific sequence, the system may spend the majority of its time performing "platter switches" rather than actual data processing.
The authors observe that the relational model is set-oriented; the order in which data is processed typically does not affect the correctness of the final result. By exploiting this flexibility, the system can treat a query plan as a pool of independent tasks rather than a linear sequence of operations.
The Reordering Framework
The proposed solution decouples the logical query plan from its physical execution order. This is achieved through a multi-component architecture centered around a dynamic scheduler.
The framework consists of four primary pillars:
- Data Fragmentation: Large relations are divided into contiguous chunks (fragments) on the storage medium.
- Subquery Extraction: Complex query plans are decomposed into "subqueries"—units of work that can be executed independently. For instance, a join between two relations is broken down into joins between their respective fragments.
- Centralized Scheduler: This unit manages pending subqueries from all active users. It determines the optimal execution order based on the current system state, such as which tape is currently mounted or which data fragments reside in the disk cache.
- Reorderable Executor: An enhanced execution engine (based on Postgres) that utilizes specialized meta-operators:
- Combine: Replaces standard scan nodes to aggregate fragmented data.
- Schedule: Facilitates communication with the scheduler to retrieve the next available subquery.
- Resolve: Manages dependencies, particularly for index scans where data requirements are determined dynamically.
Experimental Evaluation
The authors evaluated their prototype using a synthetic environment modeled after real-world hardware. The setup included a tape stacker with a 30-second switch time and a magneto-optical jukebox with a 14-second switch time. A 512 MB magnetic disk served as a cache for staging data from tertiary storage.
The evaluation focused on two primary scenarios: sequential scans and unclustered index scans. In both cases, the REORDER strategy was compared against standard prefetching and baseline execution without prefetching.
Key Findings
- Significant Speedups: For concurrent sequential scans, the reordering strategy was 15x faster than the baseline and 2x faster than standard prefetching. The most dramatic results were seen in unclustered index scans—traditionally the "worst-case" for tapes—where reordering was nearly 100x faster by converting random I/O into a single ordered pass.
- Improved Cache Efficiency: By ensuring that all queries needing a specific fragment process it while it is in the cache, the system significantly improved hit rates and reduced redundant fetches.
- Minimal Overhead: The additional logic for scheduling and fragmentation accounted for less than 1% of total execution time, making it a highly cost-effective optimization.
- Multi-User Synchronization: The scheduler effectively synchronized different users, allowing late-arriving queries to "piggyback" on data already being fetched for earlier queries.
Conclusion and Future Work
By breaking the rigid link between query planning and execution order, the authors demonstrated that tertiary memory databases can overcome mechanical latency bottlenecks. While highly effective, the approach introduces new challenges for query optimizers, which must become "reorder-aware" to accurately estimate costs. Future research will also need to address memory constraints during complex index joins and implement more robust query cancellation mechanisms to further prune unnecessary I/O.
Summary updated