On 2014年5月7日 GMT+08:00AM3:16:35, Clemens Ladisch <clem...@ladisch.de> wrote: >Woody Wu wrote: >> The following query statement executed very slow, it took 15 secs on >my ARM device, >> >> 1. select max(time) from mytable where time < 99999999 and id1 = k1 >and id2 = n. >> >> However, if I replace k1with another value that can be found in the >table and keep everything unchanged, like below, >> >> 2. select max(time) from mytable where where time < 999999999 and id1 >= k2 and id2 = n. >> >> This query run very well, it only took less than 1 second on the same >system. >> >> Could anyone explain this to me? > >The database can help with the explanation. >What is the output of EXPLAIN QUERY PLAN for both queries? > > >Regards, >Clemens >_______________________________________________ >sqlite-users mailing list >sqlite-users@sqlite.org >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
The 'explain query plan' gives same result for the first and the second query: 0|0|0|SEARCH TAB mp USING COVERING INDEX sqlite_auto_index_mp_1 (ntimereq<?) (~1 rows) BTW: I dont understand what the (~1 rows) mean. -Woody Wu _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users