SnipSuggest: Context-Aware Autocompletion for SQL

In this paper, we present SnipSuggest, a system that provides on-the-go, context-aware assistance in the SQL composition process. SnipSuggest aims to help the increasing population of non-expert database users, who need to perform complex analysis on their large-scale datasets, but have difficulty writing SQL queries. As a user types a query, SnipSuggest recommends possible additions to various clauses in the query using relevant snippets collected from a log of past queries. SnipSuggest's current capabilities include suggesting tables, views, and table-valued functions in the FROM clause, columns in the SELECT clause, predicates in the WHERE clause, columns in the GROUP BY clause, aggregates, and some support for sub-queries. SnipSuggest adjusts its recommendations according to the context: as the user writes more of the query, it is able to provide more accurate suggestions. We evaluate SnipSuggest over two query logs: one from an undergraduate database class and another from the Sloan Digital Sky Survey database. We show that SnipSuggest is able to recommend useful snippets with up to 93.7% average precision, at interactive speed. We also show that SnipSuggest outperforms naive approaches, such as recommending popular snippets.

[1]  A. Szalay Science in an Exponential World , 2008 .

[2]  Jock D. Mackinlay,et al.  The information visualizer, an information workspace , 1991, CHI.

[3]  Divesh Srivastava,et al.  Summarizing Relational Databases , 2009, Proc. VLDB Endow..

[4]  Alexander S. Szalay,et al.  SkyServer Traffic Report - The First Five Years , 2007, ArXiv.

[5]  Tiziana Catarci,et al.  Visual Query Systems for Databases: A Survey , 1997, J. Vis. Lang. Comput..

[6]  Jim Gray,et al.  2020 Computing: Science in an exponential world , 2006, Nature.

[7]  H. V. Jagadish,et al.  Assisted querying using instant-response interfaces , 2007, SIGMOD '07.

[8]  Andrei Broder,et al.  A taxonomy of web search , 2002, SIGF.

[9]  Doug Downey,et al.  Models of Searching and Browsing: Languages, Studies, and Application , 2007, IJCAI.

[10]  Georgia Koutrika,et al.  Explaining structured queries in natural language , 2010, 2010 IEEE 26th International Conference on Data Engineering (ICDE 2010).

[11]  Doug Downey,et al.  Understanding the relationship between searchers' queries and information goals , 2008, CIKM '08.

[12]  Gerhard Weikum,et al.  Probabilistic Ranking of Database Query Results , 2004, VLDB.

[13]  Neoklis Polyzotis,et al.  Query Recommendations for Interactive Database Exploration , 2009, SSDBM.

[14]  Eric Horvitz,et al.  Patterns of search: analyzing and modeling Web query refinement , 1999 .

[15]  H. V. Jagadish,et al.  Effective Phrase Prediction , 2007, VLDB.

[16]  Adriane Chapman,et al.  Making database systems usable , 2007, SIGMOD '07.