I like to solve application problems using the Web (statelessness, hypermedia, self-descriptive representations, and uniform interfaces) to produce an asymptotically tight bound solution!

Wednesday, September 09, 2009

Now published - an alternative to SQL for database storage in Web browsers

Many of us have raised serious issues with the WebDatabase API that provides SQL query access to a browser embedded database. Some of these are:
  1. Use of SQL means that it will be next to impossible to get agreement on the exact dialect supported by independent implementations.
  2. The API is extraordinarily complex that an ordinary programmer would have a hugely difficult time using it. This means more bugs will remain hidden for longer in the spec, and more bugs would be found in code using the API. The complexity arises out of a need to prevent delays when accessing a database from affecting the user interface. As a result, practically every call to the API results in an asynchronous callback.
  3. The API requires a lock acquisition scheme that does allows extremely limited parallelism in data access. As a result, superior implementations cannot do well. Even though the intention is noble - avoid producing exceptions as a result of deadlocks - the result is delays and timeouts as well as higher level deadlocks, which the programmer still has to deal with.
  4. The API has chosen to use SQL due to its well developed relational model. However, it doesn't want to provide an API that the typical database developer will be able to program against. This mythical "Web database" programmer receives undue importance in the design of the API.
  5. Overly reliant on SQL, when the data model in browsers is that of objects. This forces everyone to develop layers to translate between rowsets and objects.
There is currently a deadlock that has arisen out of a number of browser vendors refusing to go along with WebDatabase (notably Mozilla and Microsoft) and a lack of an alternative. To break this deadlock, we have developed an alternative that will provide a highly efficient and functionally rich (although less richer than SQL), called WebSimpleDatabase.

This editor's draft of WebSimpleDB is now available from W3C. I am inviting feedback on this draft so that I can incorporate it before it goes to FPWD.


Tim said...


I like the proposal and have been interested in making applications / frameworks that work on levels lower than SQL.

Can you explain some of rationale behind the interface you have proposed? Is it taken from a certain existing package (Id like to play with that package if possible)? What kind of frameworks are you expecting will be built on top of it?

Nikunj Mehta said...


The rationale for this interface is Oracle Berkeley DB. Berekeley DB has been in use from 1986 and its APIs have been offered in various languages such as PHP, Python, C, and Java.

ISAM is a general concept used in every kind of database. Some people find WebSimpleDB good for a JavaScript CouchDB. I expect to see a JavaScript SQL compiler on top of WebSimpleDB some day. I think an XQuery compiler could also be written in JavaScript to read/write from WebSimpleDB.

I hope that answers your question.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.All materials on this blog are either the original work of its owner or used with acknowledgement of the copyright owner.

About Me

My Photo
I have been an avid student of the evolution of the Web and its application to business problems.

Blog Archive

Label Cloud