Efficient and Portable Einstein Summation in SQL
Mark Blacher, Julien Klaus, Christoph Staudt, Sören Laue, Viktor Leis, Joachim Giesen
Abstract
Computational problems ranging from artificial intelligence to physics require efficient computations of large tensor expressions. These tensor expressions can often be represented in Einstein notation. To evaluate tensor expressions in Einstein notation, that is, for the actual Einstein summation, usually external libraries are used. Surprisingly, Einstein summation operations on tensors fit well with fundamental SQL constructs. We show that by applying only four mapping rules and a simple decomposition scheme using common table expressions, large tensor expressions in Einstein notation can be translated to portable and efficient SQL code. The ability to execute large Einstein summation queries opens up new possibilities to process data within SQL. We demonstrate the power of Einstein summation queries on four use cases, namely querying triplestore data, solving Boolean satisfiability problems, performing inference in graphical models, and simulating quantum circuits. The performance of Einstein summation queries, however, depends on the query engine implemented in the database system. Therefore, supporting efficient Einstein summation computations in database systems presents new research challenges for the design and implementation of query engines.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 090e606e-3d1e-4542-b892-ff12a55739e4Cited by top-tier papers7
- Quantum Data Management in the NISQ EraRihan Hai, Shih-Han Hung, Tim Coopmans, Tim Littau et al.VLDB 2025 · 10 citations
- PyTond: Efficient Python Data Science on the Shoulders of DatabasesHesam Shahrokhi, Amirali Kaboli, Mahdi Ghorbani, Amir ShaikhhaICDE 2024 · 4 citations
- EinDecomp: Decomposition of Declaratively-Specified Machine Learning and Numerical Computations for Parallel ExecutionDaniel Bourgeois, Zhimin Ding, Dimitrije Jankov, Jiehui Li et al.VLDB 2025 · 4 citations
- Galley: Modern Query Optimization for Sparse Tensor ProgramsKyle Deeds, Willow Ahrens, Magdalena Balazinska, Dan SuciuSIGMOD 2025 · 3 citations
- Proof Systems for Tensor-based Model CountingOlaf Beyersdorff, Joachim Giesen, Andreas Goral, Tim Hoffmann et al.AAAI 2026 · 1 citation
Builds on1
Related papers
- Automated Tensor-Relational Decomposition for Large-Scale Sparse Tensor ComputationYuxin Tang, Zhiyuan Xin, Zhimin Ding, Xinyu Yao et al.VLDB 2026
- Exploiting Dynamic Sparsity in EinsumChristoph Staudt, Mark Blacher, Tim Hoffmann, Lea Kasche et al.NeurIPS 2025 · 1 citation
- Einsum Trees: An Abstraction for Optimizing the Execution of Tensor ExpressionsAlexander Breuer, Mark Blacher, Max Engel, Joachim Giesen et al.ASPLOS 2025
- A Simple and Efficient Tensor CalculusSören Laue, Matthias Mitterreiter, Joachim GiesenAAAI 2020 · 40 citations
- Query Processing on Tensor Computation RuntimesDong He, Supun Chathuranga Nakandala, Dalitso Banda, Rathijit Sen et al.VLDB 2022 · 54 citations
