>It takes <1ms to return 16 rows using the first query, but over 200ms
when using the second one. What is wrong ? Is there a way to speed up
the second
>query ?

If you are using a newer version of SQLite, I suggest you run the two
queries again prefixing the SQL statement with EXPLAIN QUERY PLAN

Things to read:
http://www.sqlite.org/cvstrac/wiki?p=QueryPlans
http://www.sqlite.org/lang_explain.html

The time it takes to query is related to how many records SQLite will
return for your WHERE statement (in your case you have to ignore LIMIT
because it has to pull *all* the records initially to do the ORDER BY
statement).

Personally, searching and sorting ~1 million records in a fifth of a
second sounds quite quick to me.

Nick

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Reply via email to