Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IndexedDB Performance and IndexedDB v/s WebSQL performance comparison

WebSQL and IndexedDB are both DB API for accessing (CRUD) the underlying embedded database in the web browser. Which, if I am correct, is like SQL for accessing (CRUD) any client-server database like Oracle etc. (in many case support for both WebSQL and IndexedDB is available on same browser)

  1. So, does it mean that both WebSQL and IndexedDB are accessing (CRUD) the same underlying embedded database and if that it the case then it will have same performance on all web browsers!
  2. But I think that is not the case, so does it mean that a web browser will have more than one underlying embedded database? And why there should be 2 underlying embedded database in same browser?

And since WebSQL and IndexedDB are API's, so it means that it not entirely correct to say performance of WebSQL and IndexedDB (because they are more like query/access language), but it significantly depends upon the performance of underlying embedded database. And, as per Google, LevelDB is faster than SQLite

  1. Is it correct to say that significantly it is not the performance difference between WebSQL and IndexedDB, but performance of underlying embedded database?
  2. What are the underlying embedded database for IE, Chrome, Android browser? I couldn't find this information on web, has anybody found or compiled it ever?
like image 284
hagrawal Avatar asked Mar 23 '15 20:03

hagrawal


1 Answers

To address your first question, WebSQL was never implemented in either Internet Explorer or Firefox (http://diveintohtml5.info/storage.html, http://caniuse.com/#feat=sql-storage). In terms of the "big browsers" that leaves Chrome and Safari, both born out of WebKit (although since v28 Chrome has been running on a fork from WebKit, called 'Blink'). In the past both these browsers used SQLite as the underlying database for both WebSQL and IndexedDb, but Chrome switched IndexedDb from SQLite to LevelDB.

To answer your second question, Chrome uses 2 different underlying database technologies:

WebSQL -> SQLite

IndexedDb -> LevelDB

I suspect they keep WebSQL as SQLite as they know it works. WebSQL is now deprecated and at some point it will be removed so why would they spend time porting it over to LevelDB.

In terms of performance between WebSQL / IndexedDb versus the performance of the underlying database, from experience on iOS Safari, both IndexedDb and WebSQL uses a SQLite database but they differ vastly in how the underlying database is constructed and how they perform. In my testing I found that WebSQL was twice as fast as doing 1000 simple database inserts compared with IndexedDb on Safari in iOS8.

In terms of your last question, I found this out:

For IE:

WebSQL -> Not supported

IndexedDB -> Extensible Storage Engine

For Firefox:

WebSQL -> Not supported

IndexedDB -> SQLite

For Safari:

WebSQL -> SQLite

IndexedDB -> SQLite

For Chrome:

WebSQL -> SQLite

IndexedDB -> LevelDB

(Sources: The WebKit project, https://bugzilla.mozilla.org/show_bug.cgi?id=837141, http://www.aaron-powell.com/posts/2012-10-05-indexeddb-storage.html)

like image 101
Jonathan Smith Avatar answered Oct 19 '22 16:10

Jonathan Smith