imin
imin

Reputation: 4578

Do we need to create indexes for sqlite tables in android?

As per question..because when I read here

create a indexed column in sqlite

it seems to say that we need to create indexes manually... but when I read here

http://www.android-app-market.com/sqlite-optimization-in-android-programming-sqlite-optimization-in-android-apps.html

it says indexes are created automatically for every unique column.

Upvotes: 0

Views: 646

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006604

it says indexes are created automatically for every unique column

No, it says that indexes are created automatically for every UNIQUE column. Here, the author is not using capitalization just to be funny. It is referring to the UNIQUE keyword that can be applied to a column in a CREATE TABLE statement, indicating that all values in the column must be unique compared to all other values in that column.

Most columns in SQL tables are not UNIQUE. For some of those, if you are using them in query constraints, you will want to create indexes.

Upvotes: 2

weiyin
weiyin

Reputation: 6979

Indexes are automatically created for unique columns, as in columns that cannot have duplicate values, not "every column." You should still create indexes as necessary depending on how you query your data.

Upvotes: 1

Related Questions