# What if an SQL Statement Returned a Database?

**Authors:** Joris Nix, Jens Dittrich  
**arXiv:** [2312.00638](https://arxiv.org/abs/2312.00638)  
**Date:** 2023-12-01  
**Summary page:** https://www.summarizepaper.com/en/paper/2312.00638v1/

## Key points

- SQL statements are currently limited to returning a single table
- Limitations of this design decision for database users and architects
- Proposal to extend the SELECT-clause with a keyword 'RESULTDB' to support returning a result database instead of just a single table
- Benefits of this approach for both database users and architects
- Initial experimental study showing promising results for the proposed algorithm
- Plans to refine the algorithm and conduct more comprehensive evaluations in the future
- Highlighting the potential for exploring query optimization in the context of semi-join reductions as an interesting area for future research

## Summary

, , , , 

The paper discusses the limitations of SQL statements, which are currently restricted to returning a single table. This design decision has significant consequences for both database users and architects. For users, it results in slow query performance, long query result transfer times, and usability issues in web applications and object-relational mappers. Meanwhile, architects face challenges in designing query optimizers due to logical join enumeration effort, memory consumption for intermediate result materialization, and physical operator selection effort. To address these limitations, the authors propose extending the SELECT-clause of SQL with a keyword 'RESULTDB' to support returning a result database instead of just a single table. This extension maintains clear semantics by only returning subsets of all tables with tuples that would be part of the traditional query result set without performing any denormalization through joins. Importantly, this SQL-extension is backward compatible. The authors also discuss the numerous benefits of their approach. For database users, it simplifies application code and improves query performance by reducing query results and transfer times. For database architects, they present methods to integrate this feature into both closed-source and open-source database systems. The paper includes an initial experimental study that shows promising results for their proposed algorithm. The authors plan to further refine their algorithm and conduct more comprehensive evaluations in the future. They also highlight the potential for exploring query optimization in the context of semi-join reductions as an interesting area for future research.
