skip to main content
10.1145/2815072.2815080acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Using dependent types and tactics to enable semantic optimization of language-integrated queries

Published: 27 October 2015 Publication History

Abstract

Semantic optimization --- the use of data integrity constraints to optimize relational queries --- has been well studied but, owing to limitations in how SQL handles constraints, has not often been applied by mainstream RDBMSs. In a language-integrated query setting, however, the query provider is free to rewrite queries before they are executed on an RDBMS. We show, using Coq as our ambient language, how to use dependent types to represent a well known class of constraints --- embedded, implicational dependencies --- and how Coq tactics can be used to implement a particular kind of semantic optimization: tableaux minimization, which minimizes the number of joins required by a query.

References

[1]
Serge Abiteboul, Richard Hull, and Victor Vianu. Foundations of Databases. Addison-Wesley, 1995.
[2]
Agda Development Team. The Agda proof assistant reference manual, version 2.4.2. 2014.
[3]
Michael Barr and Charles Wells, editors. Category theory for computing science, 2nd ed. 1995.
[4]
Vronique Benzaken, velyne Contejean, and Stefania Dumbrava. A Coq Formalization of the Relational Data Model. In Zhong Shao, editor, Programming Languages and Systems, volume 8410 of Lecture Notes in Computer Science, pages 189–208. 2014.
[5]
Yves Bertot and Pierre Castéran. Interactive Theorem Proving and Program Development. Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer Verlag, 2004.
[6]
Edwin Brady. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming, 23:552–593, 9 2013.
[7]
Benjamin Delaware, Clément Pit-Claudel, Jason Gross, and Adam Chlipala. Fiat: Deductive synthesis of abstract data types in a proof assistant. In POPL’15, pages 689–700, 2015.
[8]
Alin Deutsch, Lucian Popa, and Val Tannen. Query reformulation with constraints. SIGMOD Rec., 35:65–73, March 2006.
[9]
Dominique Devriese and Frank Piessens. Typed Syntactic Metaprogramming. ICFP ’13, pages 73–86, 2013.
[10]
Tom Ellis. Opaleye. Technical report, http://github.com/tomjaguarpaw/haskell-opaleye.
[11]
Benedict R. Gaster and Mark P. Jones. A polymorphic type system for extensible records and variants. Technical Report NOTTCS-TR-96-3, Department of CS, University of Nottingham, November 1996.
[12]
Gregory Malecha. Extensible Proof Engineering in Intensional Type Theory. PhD thesis, Harvard University, 2014.
[13]
Torsten Grust. Monad Comprehensions. A Versatile Representation for Queries. In The Functional Approach to Data Management, P.M.D. Gray and L. Kerschberg and P.J.H. King and A. Poulovassilis (eds.). Springer Verlag, 2003.
[14]
Laura M. Haas, Mauricio A. Hernández, Howard Ho, Lucian Popa, and Mary Roth. Clio grows up: from research prototype to industrial tool. In SIGMOD, 2005.
[15]
Qi Heng, Jarek Gryz, and et al. Implementation of Two Semantic Query Optimization Techniques in DB2 Universal Database. VLDB, 1999.
[16]
S. Kazem Lellahi and Val Tannen. A calculus for collections and aggregates. In CTCS ’97, 1997.
[17]
Gregory Malecha, Adam Chlipala, and Thomas Braibant. Compositional Computational Reflection. In Gerwin Klein and Ruben Gamboa, editors, Interactive Theorem Proving, volume 8558 of Lecture Notes in Computer Science, pages 374–389. 2014.
[18]
Gregory Malecha, Greg Morrisett, Avraham Shinnar, and Ryan Wisnesky. Toward a verified relational database management system. POPL ’10, pages 237–248, New York, NY, USA, 2010. ACM.
[19]
Lucian Popa and Val Tannen. An equational chase for pathconjunctive queries, constraints, and views. In ICDT, 1999.
[20]
Antonis Stampoulis and Zhong Shao. VeriML: Typed Computation of Logical Terms Inside a Language with Effects. ICFP ’10, pages 333–344, New York, NY, USA, 2010. ACM.
[21]
Val Tannen, Peter Buneman, and Limsoon Wong. Naturally embedded query languages. ICDT ’92, pages 140–154, 1992.
[22]
Paul van der Walt and Wouter Swierstra. Engineering proof by reflection in agda. In Implementation and Application of Functional Languages, Lecture Notes in Computer Science, pages 157–173. Springer Berlin Heidelberg, 2013.
[23]
Beta Ziliani, Derek Dreyer, Neelakantan R. Krishnaswami, Aleksandar Nanevski, and Viktor Vafeiadis. Mtac: A monad for typed tactic programming in coq. In ICFP’13, ICFP ’13, pages 87–100, New York, NY, USA, 2013. ACM.

Cited By

View all
  • (2019)Understanding Event Organization at Scale in Event-Based Social NetworksACM Transactions on Intelligent Systems and Technology10.1145/324322710:2(1-23)Online publication date: 12-Jan-2019
  • (2018)Understanding and Combating Memory Bloat in Managed Data-Intensive SystemsACM Transactions on Software Engineering and Methodology10.1145/316262626:4(1-41)Online publication date: 3-Jan-2018
  • (2017)Synthesis of divide and conquer parallelism for loopsACM SIGPLAN Notices10.1145/3140587.306235552:6(540-555)Online publication date: 14-Jun-2017
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
DBPL 2015: Proceedings of the 15th Symposium on Database Programming Languages
October 2015
78 pages
ISBN:9781450339025
DOI:10.1145/2815072
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 27 October 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Chase
  2. Coq
  3. LINQ
  4. semantic optimization

Qualifiers

  • Research-article

Conference

SPLASH '15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 10 of 15 submissions, 67%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)2
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2019)Understanding Event Organization at Scale in Event-Based Social NetworksACM Transactions on Intelligent Systems and Technology10.1145/324322710:2(1-23)Online publication date: 12-Jan-2019
  • (2018)Understanding and Combating Memory Bloat in Managed Data-Intensive SystemsACM Transactions on Software Engineering and Methodology10.1145/316262626:4(1-41)Online publication date: 3-Jan-2018
  • (2017)Synthesis of divide and conquer parallelism for loopsACM SIGPLAN Notices10.1145/3140587.306235552:6(540-555)Online publication date: 14-Jun-2017
  • (2017)HoTTSQL: proving query rewrites with univalent SQL semanticsACM SIGPLAN Notices10.1145/3140587.306234852:6(510-524)Online publication date: 14-Jun-2017
  • (2017)DéjàVu: a map of code duplicates on GitHubProceedings of the ACM on Programming Languages10.1145/31339081:OOPSLA(1-28)Online publication date: 12-Oct-2017
  • (2017)Prototyping a query compiler using Coq (experience report)Proceedings of the ACM on Programming Languages10.1145/31102531:ICFP(1-15)Online publication date: 29-Aug-2017
  • (2017)HoTTSQL: proving query rewrites with univalent SQL semanticsProceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3062341.3062348(510-524)Online publication date: 14-Jun-2017
  • (2017)Handling Environments in a Nested Relational Algebra with Combinators and an Implementation in a Verified Query CompilerProceedings of the 2017 ACM International Conference on Management of Data10.1145/3035918.3035961(1555-1569)Online publication date: 9-May-2017
  • (2016)Extensible and Efficient Automation Through Reflective TacticsProceedings of the 25th European Symposium on Programming Languages and Systems - Volume 963210.5555/3089528.3089549(532-559)Online publication date: 2-Apr-2016
  • (2016)Extensible and Efficient Automation Through Reflective TacticsProgramming Languages and Systems10.1007/978-3-662-49498-1_21(532-559)Online publication date: 2016

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media