On 25-06-2011 15:37, Black, Michael (IS) wrote: > And...this select does it at the speed you expect since it uses the indexes > for min/max.\ > > > > This one I ran with 3.7.7 > > > > sqlite> select * from (select min(i) from test) as a,(select max(i) from > test) as b, (select count(i) from test) as c; > min( max(i) coun > ---- ------------- ---- > 37 2147483025 10000000 > CPU Time: user 1.807726 sys 0.079987 > > Even though the query plan looks nastier: > > sqlite> explain query plan select * from (select min(i) from test) as > a,(select max(i) from test) as b, (select count(i) from test) as c; > sele order from deta > ---- ------------- ---- ---- > 1 0 0 SEARCH TABLE test USING COVERING INDEX idx (~1 > rows) > 2 0 0 SEARCH TABLE test USING COVERING INDEX idx (~1 > rows) > 3 0 0 SCAN TABLE test (~10000000 rows) > 0 0 0 SCAN SUBQUERY 1 AS a (~1 rows) > 0 1 1 SCAN SUBQUERY 2 AS b (~1 rows) > 0 2 2 SCAN SUBQUERY 3 AS c (~1 rows) >
ah, that explains ;) _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users