I assume the hash column is NOT an INTEGER PRIMARY KEY because you
have to allow for collisions.
If the hash column were an INTEGER PRIMARY KEY than you would have a
single b-tree lookup when for lookups by hash, as opposed to two
b-tree lookups if the key were not an INTEGER PRIMARY KEY... unless
the index for lookup by name were a covering index.
But since you have to allow for hash collisions, so the hash column
can't be an INTEGER PRIMARY KEY.
Two possibilities come to mind: a) you have a covering index for
lookups by hash but not by name, b) lookups by hash require fewer I/Os
than lookup by name because hash values encode significantly smaller
than the names.
You should EXPLAIN QUERY PLAN for both queries.
Nico
--
_______________________________________________
sqlite-users mailing list
sqlite...@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Because a hash would only help with conditions of the form "textField = ?", while the kind of b-tree index that SQLite utilizes also works for "textField > ?" and "order by textField".
--
Igor Tandetnik