views:

37

answers:

1

When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created for it as well? SQLite does not appear to automatically create an index for a primary key column, but perhaps it indexes it anyway, given its purpose? (I will be searching on that column all the time).

Would the situation be any different for a string primary key?

+2  A: 

it does it for you.

http://www.sqlite.org/lang_createtable.html

it there in the middle.

hvgotcodes
Indeed, it says "The PRIMARY KEY attribute normally creates a UNIQUE index on the column or columns that are specified as the PRIMARY KEY". However, that index is not visible in SQLite management applications, that's why I asked.
moodforaday
It's mention in the `sqlite_master` table with a name starting with `sqlite_autoindex_`.
dan04