Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite index on index columns? #210

Closed
rkistner opened this issue Jun 26, 2015 · 2 comments
Closed

SQLite index on index columns? #210

rkistner opened this issue Jun 26, 2015 · 2 comments
Assignees
Milestone

Comments

@rkistner
Copy link

This is more of an implementation question, not a bug.

This project has a very interesting implementation for IDB indexes on top of SQLite.

I see indexes are created by creating a new BLOB column in the table, and using a specific encoding to allow correct sorting/filtering.

This is done here:

https://github.com/axemclion/IndexedDBShim/blob/master/src/IDBIndex.js#L96

However, I don't see that a SQLite index is ever created on that column. It seems like the entire point of the special encoding of keys would be allowing a SQLite index to be used on that. Am I just missing it? Or is there a reason that no index is added?

@brettz9
Copy link
Collaborator

brettz9 commented Jun 17, 2016

I think we'd be open to a PR for this, as I don't see why we shouldn't have a SQLite index on the column (and possibly others) unless there is potential for file size problems or lack of implementation support for indexes (I don't know).

I think we should probably add indexes optionally via config.

@brettz9 brettz9 added this to the 4.0.0 milestone Jan 20, 2017
@brettz9 brettz9 self-assigned this Jan 20, 2017
brettz9 added a commit to brettz9/IndexedDBShim that referenced this issue May 11, 2017
- dist: Remove old Node minified files
- Enhancement: Add `useSQLiteIndexes` option to add (and drop) SQLite
    indexes where utilized (indexeddbshim#210)
- Fix: Ensure prevunique cursor presorts key in ascending order so will skip over later keys
- Docs (README): Add link to IDB spec
- Testing (QUnit, Fake, Mock, W3C Old, Mocha, W3C): Utilize `useSQLiteIndexes` config in tests (more complex)
- Testing (Qunit): Remove references to old Node minified files
brettz9 added a commit to brettz9/IndexedDBShim that referenced this issue May 11, 2017
- dist: Remove old Node minified files
- Enhancement: Add `useSQLiteIndexes` option to add (and drop) SQLite
    indexes where utilized (indexeddbshim#210)
- Fix: Ensure prevunique cursor presorts key in ascending order so will skip over later keys
- Docs (README): Add link to IDB spec
- Testing (QUnit, Fake, Mock, W3C Old, Mocha, W3C): Utilize `useSQLiteIndexes` config in tests (more complex)
- Testing (Qunit): Remove references to old Node minified files
brettz9 added a commit to brettz9/IndexedDBShim that referenced this issue May 11, 2017
- dist: Remove old Node minified files
- Enhancement: Add `useSQLiteIndexes` option to add (and drop) SQLite
    indexes where utilized (indexeddbshim#210)
- Fix: Ensure prevunique cursor presorts key in ascending order so will skip over later keys
- Docs (README): Add link to IDB spec
- Testing (QUnit, Fake, Mock, W3C Old, Mocha, W3C): Utilize `useSQLiteIndexes` config in tests (more complex)
- Testing (Qunit): Remove references to old Node minified files
- Testing/Grunt: Switch to non-minified babel-polyfill
brettz9 added a commit to brettz9/IndexedDBShim that referenced this issue May 11, 2017
    indexes where utilized (indexeddbshim#210)
- Fix: Ensure `prevunique` cursor presorts key in ascending order so will skip over later keys
- dist: Remove old Node minified files
- Docs (README): Add link to IDB spec
- Testing (QUnit, Fake, Mock, W3C Old, Mocha, W3C): Utilize `useSQLiteIndexes` config in tests (more complex)
- Testing (Qunit): Remove references to old Node minified files
- Testing/Grunt: Switch to non-minified babel-polyfill
@brettz9
Copy link
Collaborator

brettz9 commented May 11, 2017

This is now implemented in master/RC 8. When the config useSQLiteIndexes is set to true, we apply simple indexes for the following:

  1. The table we use to manage database name/versions (dbVersions)
  2. The table we use to keep track of store metadata (__sys__)
  3. The key column of the store content table (a table named after the store)
  4. The index columns of the store content table (a table named after the store)

Btw, the reason for the special encoding of keys also relates to IndexedDB sorting requirements.

Thanks for the report!

@brettz9 brettz9 closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants