W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2014

Re: IDBObjectStore/IDBIndex.exists(key)

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 23 Jun 2014 12:21:26 -0700
Message-ID: <CA+c2ei9paWzmkrDME5+vh0u31YUEwMBE7io-_QxMmBsfY=J2dQ@mail.gmail.com>
To: Joshua Bell <jsbell@google.com>
Cc: ben turner <bent.mozilla@gmail.com>, Webapps WG <public-webapps@w3.org>
On Mon, Jun 23, 2014 at 9:59 AM, Joshua Bell <jsbell@google.com> wrote:
> On Sat, Jun 21, 2014 at 9:45 PM, ben turner <bent.mozilla@gmail.com> wrote:
>> I think this sounds like a fine idea.
>> -Ben Turner
>> On Sat, Jun 21, 2014 at 5:39 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>> Hi all,
>>> I found an old email with notes about features that we might want to put
>>> in v2.
>>> Almost all of them was recently brought up in the recent threads about
>>> IDBv2. However there was one thing on the list that I haven't seen brought
>>> up.
>>> It might be a nice perf improvement to add support for a
>>> IDBObjectStore/IDBIndex.exists(key) function.
> This sounds redundant with count().
> Was count() added to the spec after that note was written? (count() seems to
> be a relatively late addition, given that it occurs last in the IDLs)

Hmm.. good point. It is indeed very possible that I wrote that note
before we had count().

There is a small performance difference between them though when
applied to indexes. Indexes could have multiple entries with the same
key (but different primaryKey), in which case count() would have to
find all such entries, whereas exists() would only need to find the

But most of the time count() probably does well enough.

/ Jonas
Received on Monday, 23 June 2014 19:22:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:25 UTC