Jeff, try this select instead 

sqlite> EXPLAIN QUERY PLAN SELECT events.* FROM events WHERE
eid<=32619760 and +type=22  ORDER BY eid DESC LIMIT 1;
0|0|TABLE events USING PRIMARY KEY ORDER BY


Regards-- Noah

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, July 01, 2008 9:44 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Index and ORDER BY

I agree.  If I drop indices that use "type", I get my performance back  
for this query:

sqlite> SELECT events.* FROM events WHERE eid<=32619760 AND type=22  
ORDER BY eid DESC LIMIT 1;
16643833|27906245|5972704|0|22|9|4
CPU Time: user 0.001000 sys 0.001000

sqlite> EXPLAIN QUERY PLAN SELECT events.* FROM events WHERE  
eid<=32619760 AND type=22 ORDER BY eid DESC LIMIT 1;
0|0|TABLE events USING PRIMARY KEY ORDER BY

The problem is that indexing the type column gives me a huge  
performance benefit for other queries in my application.  Is there any  
way I can force sqlite to not use an index for a particular query?
        Thanks for your help!
        Jeff



CONFIDENTIALITY NOTICE: 
This message may contain confidential and/or privileged information. If you are 
not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose, or take any action based on this message or any 
information herein. If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. Thank you for 
your cooperation.


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

Reply via email to