Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active September 12, 2022 19:40
Show Gist options
  • Save nolanlawson/a841ee23436410f37168 to your computer and use it in GitHub Desktop.
Save nolanlawson/a841ee23436410f37168 to your computer and use it in GitHub Desktop.
What's missing in Microsoft's implementation of IndexedDB

What's missing in Microsoft's implementation of IndexedDB

Per a discussion with Christian Heilmann, I've put together a little doc outlining the current IndexedDB issues in IE 10-11 and Edge.

Major blockers

The biggest issue with IE's implementation is the lack of multiEntry, complex keys, or compound keypaths. Kyaw Tun (creator of YDN-DB) has grumbled a lot about this, and David Fahlander (Dexie.js creator) has written a heroic polyfill called IEGap that adds the missing behavior. (Although per David, it passes the W3C tests but not all the Dexie tests due to some tricky edge cases.)

In PouchDB, we have some elaborate workarounds for the lack of compound keys, e.g. concatenating strings instead of using arrays (see point #5 in this article). However, the lack of multiEntry is worse, because it prohibits us from using schemas that would offer some huge performance improvements in Chrome and Firefox. Lack of multiEntry would also cause problems for anyone trying to implement something like Lucene on top of IndexedDB, because you would want to implement the reverse index as an array of string tokens inside of a document.

I filed this as an issue on Microsoft Connect. So far no feedback, except for acknowledgement of receipt.

Smaller annoyances

IE has some race conditions if you open two database with the same name, or if you try to destroy a database while opening another one with the same name. We worked around this in PouchDB by serializing all access to IDB. The issue is here.

There is also a bug when opening IndexedDB inside a web worker, which currently renders PouchDB totally unusable inside of a web worker on IE. I filed it here.

Both of these issues have reproducible test cases attached.

Big picture

Currently IE scores lower than any other browser on the W3C IndexedDB test suite. I find that a bit astonishing, given that most developers judge Safari to be far worse. But if you're looking for stuff to improve, that may be a good place to start. :)

Cheers, and thanks for listening to my complaints!

@bemson
Copy link

bemson commented Dec 18, 2015

I forked your IndexedDB with WebWorkers gist to file a bug regarding IndexedDB access in Blob-Workers. I doubt it will be fixed, but wanted to thank you for your efforts here. (Also, of course, feel free to point out anything I missed!)

@evanuk
Copy link

evanuk commented Mar 19, 2018

There seems to be an (undocumented?) limit to IndexedDB database versions in IE10/11.

indexedDB.open(name, version) fails with version > 1073741823 (2^30).

Thanks for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment