I have a composite index on queuedb made up of q_id, date,priority(in the same order). I am trying to find out if the index is being used for both the where clause and the order by clause. I have also posted the output for EXPLAIN QUERY PLAN. dbsql> explain select * from queuedb where q_id='598535' order by q_id, date,priority LIMIT 1; addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Trace 0 0 0 00 1 Noop 0 0 0 00 2 Integer 1 1 0 00 3 String8 0 2 0 598535 00 4 Goto 0 32 0 00 5 OpenRead 0 3 0 15 00 6 OpenRead 2 4 0 keyinfo(5,BINARY,BINARY) 00 7 SeekGe 2 29 2 1 00 8 IdxGE 2 29 2 1 01 9 IdxRowid 2 3 0 00 10 Seek 0 3 0 00 11 Column 2 0 4 00 12 Column 2 1 5 00 13 Column 2 2 6 00 14 Column 2 4 7 00 15 Column 0 4 8 00 16 Column 0 5 9 00 17 Column 0 6 10 00 18 Column 0 7 11 00 19 Column 0 8 12 00 20 Column 0 9 13 00 21 Column 2 3 14 00 22 Column 0 11 15 00 23 Column 0 12 16 00 24 Column 0 13 17 00 25 Column 0 14 18 00 26 ResultRow 4 15 0 00 27 IfZero 1 29 -1 00 28 Next 2 8 0 00 29 Close 0 0 0 00 30 Close 2 0 0 00 31 Halt 0 0 0 00 32 Transaction 0 0 0 00 33 VerifyCookie 0 4 0 00 34 TableLock 0 3 0 queuedb 00 35 Goto 0 5 0 00
dbsql> explain query plan select * from queuedb where q_id='598535' order by q_id, date,priority LIMIT 1; orde from deta ---- ------------- ---- 0 0 TABLE queuedb WITH INDEX q_index ORDER BY Why is it not indicating that the ORDER BY is using the index? Or is it really using it? The VDBE output suggests that it had to go through a few columns so I suspect it is not using the index for ORDER BY. Please help me understand this issue. Thanks -- View this message in context: http://old.nabble.com/Question-about-explain-plain-tp30486201p30486201.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users