On 6/24/2011 1:58 PM, logan...@gmail.com 
wrote:
> Sorry, but seems like I'm missing something here.
>
>  From my understanding it looks like for Integer ID columns that are PK
> SQLite doesn't generate any indexes. Is this true?

It's true in a narrow technical sense, but it doesn't matter in practice.

In SQLite, data is organized in B-trees. Each table and each index is a 
B-tree. For an index, the key into that B-tree is the set of fields the 
index is built on. For a table, each row has a unique integer 
identifier, usually referred to as RowId, which serves as a key into the 
table's B-tree. Looking up a row in the table by its RowId is as fast as 
looking up an index entry by its key, because it's really the same 
operation.

When you declare a column as INTEGER PRIMARY KEY, SQlite simply makes it 
an alias for an already-existing, always-present RowId column. Again, 
the table itself essentially acts as an index on this column, no 
additional external data structure is necessary.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to