On 12 Nov 2011, at 2:37pm, Igor Tandetnik wrote: > ANALYZE
Yeah. Do an ANALYZE. Then test timing with and without the CAST. See if it helps. I don't understand why your query should be faster when you suppress a useful index. Oh wait. Your entire WHERE clause is about the joined table. So merge the ON and WHERE clauses ... INNER JOIN messages ON (messages.message_ID = senders.message_ID AND messages.TimeStamp BETWEEN 0 AND 9999999999) And supply one INDEX on messages which allows both operations: CREATE INDEX messages_timestamp_index ON messages (message_ID,TimeStamp); Or would it be better to swap the order or the indexes ? Maybe create them both, then see which one it uses. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users