BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Lovefield: An SQL-like Query Engine by Google

Lovefield: An SQL-like Query Engine by Google

Bookmarks

Lovefield is a JavaScript library providing an SQL-like query engine to web developers who want the benefits of a relational database.

Back in 2010 Chrome 4 included the WebSQL Database API, an attempt to provide an SQL data store to web developers. Chrome’s persistence store was SQLite. Safari developers were also working on supporting the API. The problem was that W3C stopped working on the API specification because “all interested implementors have used the same SQL backend (Sqlite), but we need multiple independent implementations to proceed along a standardization path.” W3C continued working on Web Storage, a simple key-value storing solution, and Indexed Database API, both largely adopted by major browsers.

Now, Google wants to bring back the relational database to web developers via Lovefield, a cross-browser SQL-like query engine. Lovefield does not include an SQL query parser, but it comes in the form of a JavaScript library which provides support for a limited subset of SQL 2003. Developers interrogate the database using JavaScript function calls. The engine is using IndexedDB as persistence store, but it can also run on a memory-based temporary store for testing purposes. Lovefield is targeted at applications with smaller storage needs: datasets are currently limited at 2GB, and the engine performs reasonably until 50K rows, but performance will be improved in the future, according to Demetrios Papadopoulos, a developer on the Chrome team.

Lovefield supports:

  • Queries: select, insert, update, delete

  • Transactions

  • Integrity constraint checks

  • Aggregators (count, min, max, sum, avg, stddev, distinct)

  • Multi-table joins

  • Schema upgrades

  • Promises

  • It is design with low-end devices in mind

  • Works on Chrome, Firefox and IE10, providing polyfills where necessary. Support for Safari is on hold until there is an “usable” IndexedDB implementation.

Some SQL features are not going to be implemented, such as cursors, views, sub-queries, and triggers.

Without providing details, Google mentioned their intent to standardize this technology in the future, and has used it for a Chrome app, Google Play Movies&TV.

Lovefield currently supports only JavaScript, but it may add support for other languages in the future. One likely implementation is Dart.

Related resources: Lovefield Specification, Design, GitHub Repository.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT