- From: Kyaw Tun <kyawtun@yathit.com>
- Date: Mon, 12 Nov 2012 22:22:11 +0800
- To: public-webapps@w3.org
- Message-ID: <CAFPCW95eic45XGBmj-Jbc2ex1BqCobnV=+K8wBo67F+3hQURnQ@mail.gmail.com>
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 records. 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 wrapper<http://dev.yathit.com/api-reference/ydn-db/storage.html>, 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, Kyaw
Received on Tuesday, 13 November 2012 14:32:32 UTC