[w3c/IndexedDB] "Join" queries on multiple object stores (#92)

PouchDB implements two browser adapters, WebSQL and IndexedDB, both of which are heavily optimized. So it provides a nice point of comparison between the two in browsers that implement both (e.g. Chrome), at least for implementing a CouchDB-like API.

Currently one of the biggest performance differences between the WebSQL and the IDB adapter is the [allDocs() API](https://pouchdb.com/api.html#batch_fetch), which fetches multiple "documents" by combining two objectStores/tables under the hood (see discussion: https://github.com/pouchdb/pouchdb/issues/3921#issuecomment-107954085).

The reason the WebSQL version can be optimized so much more than the IDB version is simple: in WebSQL we build one large `SELECT` statement with a `JOIN` and various conditions on the two tables, whereas in IDB we have to use cursors to iterate through two objectStores, using an object value in one store as the foreign key in the other store.

Related to #45, it would be nice to have a way to fire multiple queries on multiple object stores at the same time, while defining a foreign key to join the two. I don't yet have any ideas for what this API might look like, but it would be very useful.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/92

Received on Thursday, 22 September 2016 16:06:24 UTC