W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2012

IDBObjectStore require openKeyCursor method

From: Kyaw Tun <kyawtun@yathit.com>
Date: Mon, 12 Nov 2012 22:22:11 +0800
Message-ID: <CAFPCW95eic45XGBmj-Jbc2ex1BqCobnV=+K8wBo67F+3hQURnQ@mail.gmail.com>
To: public-webapps@w3.org
In contrast to IDBIndex, IDBObjectStore does not have openKeyCursor method.
This method fetch list of keys of a given range without cost
of serialization. There is no other ways to iterate keys only from
IDBObjectStore. However efficient fetching of keys in a specific range is
required in high performance web app.

Use case 1: Suppose 'note' object store use in-line key 'title' (possibly
adding a nonce). Developer wish to list titles without retrieving full

Use case 2: Suppose 'article' object store use array keys having first
element as author id, which is key to 'author' object store and second
element as time stamp. Efficient retrieval of list of articles by an author
is possible by fetching IDBKeyRange.bound([author_id], [author_id, 0]) by
indexing primary key.

Use case 3: I am developing IndexedDB database
which use key scanning to run join algorithm with sorting and constrain.
Sometimes, the use case require iterating of primary key.

The workaround suggested in use case 2, it not applicable for out-of-line
key. Also indexing primary key is conter intuitive.

Since primary key will already have indexed in the database engine,
openKeyCursor method should provide in IDBObjectStore object. At the same
time, we get consistance and symmetric API.

Best regards,
Received on Tuesday, 13 November 2012 14:32:32 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:50 UTC