dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.43k stars 641 forks source link

Expose createIndex() of IDBObjectStore #733

Open ChrisProlls opened 6 years ago

ChrisProlls commented 6 years ago

We store a huge model with more than 70 properties. We would like to filter with about 20 properties, and with all possible combinations of these filters at the same time. Creating all index combination statically is very huge, we would like to create indexes dynamically following filters we would like to apply to the object store.

I found that IndexedDB exposes a createIndex() method. Is it possible to do the same throught DexieJS ?

nponiros commented 6 years ago

You can create an index using Dexie but this is as far as I remember only possible during a version upgrade. I think the same is the case when using IndexedDB directly.

I don't know exactly what you mean by "create indexes dynamically" but generally speaking it is pretty useless to create an index when the user is ready to do a search as the DB would have to index each and every record and then start the search. That would probably be slower than just reading all the records and doing the filtering in JavaScript.

ChrisProlls commented 6 years ago

Thanks for your response :) Effectively we built a 2-levels filtering engine for our application

We understand now the limitation of IndexedDB ;)