"Dennis Volodomanov" <[EMAIL PROTECTED]> wrote: > Ok, thank you for clarifying those points to me. > > At the moment I'm struggling to understand why running a > > SELECT ROWID FROM TableA WHERE colA='a' > > Takes almost twice as long as > > SELECT ROWID FROM TableA WHERE colA='b' > > Running on the same table with the same data with colA indexed. > Unfortunately, the real queries are not as simple, although still the > same between each other, just different data. I'm still in the process > of singleing out the query that is different (using EXPLAIN), so as soon > as I know which it is I'll be able to study it and see how can I change > it. >
Run ANALYZE then look at the lines of sqlite_stat1 that pertain to TableA. I'm guessing you will find that colA is not very selective. That is to say, a large fraction (perhaps half) of the rows in tableA have 'a' as their value for colA. If requesting more than just ROWID in the return set, this can result in a significant slowdown. Running ANALYZE might give the query optimizer enough clues to figure that out, by the way. So try rerunning the query after you run ANALYZE and see if it helps. -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------