Database Theory in Action: Direct Access to Query Answers
Jiayin Hu, Nikolaos Tziavelis
TL;DR
The paper addresses direct access to query answers by rank under a given order, bridging theory with practice by implementing direct-access and single-access algorithms across lexicographic and sum orders. It presents SQL-based expressions (OFFSET/LIMIT and a ROW_NUMBER() window with a CTE) and an independent implementation that covers a broad class of conjunctive queries, including full and partial rankings, with automatic tractability checks. Through experiments, it compares against PostgreSQL's strategies, showing competitive performance for large results and a clear break-even point after a few accesses where direct access becomes advantageous. The work highlights practical implications for interactive querying and histogram construction, and outlines future directions for tighter DBMS integration and parallelization.
Abstract
Direct access asks for the retrieval of query answers by their ranked position, given a query and a desired order. While the time complexity of data structures supporting such accesses has been studied in depth, and efficient algorithms for many queries and common orders are known, their practical performance has received little attention. We provide an implementation covering a wide range of queries and orders; it allows us to investigate intriguing practical aspects, including the comparative performance of database systems and the relationship between direct access and its single-access counterpart.
