----- Original Message ----- From: "Brandon, Nicholas (UK)" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org> Sent: Monday, July 03, 2006 1:59 PM Subject: RE: [sqlite] Performance of two queries, why such big difference ?
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 ?
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 B>Y statement). Personally, searching and sorting ~1 million records in a fifth of a second sounds quite quick to me.
Yes, but it completes the first query in 1ms somehow, so where is the difference ? Even if the whole file resides in a system file cache, there should be a similar results a 1ms ( or 200ms ) for both cases. Apparently it don't have to pull all records in the first case.