On 25 Jun 2011, at 1:37pm, Luuk wrote: > Giving the SELECTs i a different order does not improve thing (much). > BTW, i'm doing this on a Windows 7 machine, and will test what happens > on a Linux machine too, to see if there's difference. > > SQLite version 3.7.2 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .timer on > sqlite> select min(i) from test; > 1 > CPU Time: user 0.000000 sys 0.000000 > sqlite> select max(i) from test; > 9999999 > CPU Time: user 0.000000 sys 0.000000 > sqlite> select count(i) from test; > 9999999 > CPU Time: user 1.560010 sys 0.296402 > sqlite> select min(i),max(i),count(i) from test; > 1|9999999|9999999 > CPU Time: user 4.430428 sys 0.312002
Luuk, because of the structure SQLite uses for indexes, it can find both max() and min() instantly, but has to actually read every record to find count(). I know this seems weird, but that's the way it is. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users