Parth Bhatt
Parth Bhatt

Reputation: 19469

How to do indexing of Sqlite database table which contains 18000 enteries

I am making an iPhone app where I am using Sqlite database table which has 18000 enteries.

When I do a search from that table, it is slow.

I want it to be faster and hence I am trying to add indexing to my database table.

How can I do indexing of Sqlite database table?

What steps should I follow?

Upvotes: 2

Views: 2325

Answers (2)

iKushal
iKushal

Reputation: 2889

This is the single column index

CREATE INDEX name_index ON Employee (Employee_Name)

multi-column index

CREATE INDEX name_index  ON Employee (Employee_Name, Employee_Age)

Upvotes: 0

Michael Low
Michael Low

Reputation: 24506

Have you seen the SQLite create index page - http://www.sqlite.org/lang_createindex.html ?

A typical create index statement looks like CREATE INDEX indexName ON tableName ( thisColumn ). If you're not sure which column to index, you'll find lots of information by Googling. Any columns you search on, join on or order by would be a good start, though.

Upvotes: 8

Related Questions