On 8/21/2016 4:37 AM, Kousik Kundu wrote:
/but if I search as - / sqlite3 test.db "select * from n WHERE rsid = 'rs123'" - /It takes long time
Create your index on nn(rsid, gene). Order of the fields matters. Imagine a phonebook sorted by last name then first name. It's easy to find in it all people named John Smith, or all people with last name of Smith, but it's of no help when looking for all people named John.
I want to search by either of the column name or with the combination.
Then you need two indexes - one on columns (X, Y) and the other on Y alone (it doesn't matter which of the two is X and which is Y in this case). The (X, Y) index also works for searching on X, but not for searching on Y.
-- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users