Hello and Happy New year!
I have an indexing problem with a very simple query.
The correct index is not used or no index is used, according to Explain
Query Plan.
In the following query, all columns but num have indexes, using default.
num is integer; filetype is Varchar; time1 is Datetime; name is varchar.


This query:
select * from tbl where num = 2563351070  and
filetype = 'cpp'  and
time1 > '2003-01-01' and time1 < '2006-05-05'
returns 18k rows in 600ms and index for time1 is used.

If I 'plus' the time1 columns, the exec time drops to 420ms and
no index is used.
If I use 'name' instead of 'filetype' with time1 "plussed", no index is
used.
Also, if I use 'order by name', no index is used.

To summarize, in this query with indexes on most columns, SQLite will only
use time1 index and is slower doing so.
Could someone please explain to me why this happens?
Thanks.
Michael





-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to