Reputation: 1613
My android application needs frequent access to sqlite database. I was thinking if there is a way to index the database to have faster access to data. Ha anyone done indexing of database in android? Please suggest me the best way to do that?
Is it really needed as we have all the database on local device and even running query everytime will not take much time.
Rgds, Sapan
Upvotes: 4
Views: 2756
Reputation: 78523
SQLite supports the CREATE INDEX statement:
http://www.sqlite.org/lang_createindex.html
e.g.:
create index foo_bar_idx on foo(bar);
For an in-depth discussion in when a query planner would decide to use an index, try the PostgreSQL documentation instead:
http://www.postgresql.org/docs/9.0/static/indexes.html
It won't work in the exact same way in SQLite, but the general ideas are the same:
Upvotes: 7