Isaac Goldberg wrote: > I'm seeing that EXPLAIN QUERY PLAN returns SEARCH instead of SCAN when > using min() or max(). For example: > > sqlite> create table t(a int, b int); > sqlite> explain query plan select min(b) from t; > 0|0|0|SEARCH TABLE t > > Why is this a SEARCH instead of a SCAN? Furthermore, is it expected that > sometimes SEARCH can be returned with no specified index like this?
This is a side effect of the MIN/MAX optimization: <http://www.sqlite.org/optoverview.html#minmax> The query planner has noticed that the query itself would be eligible for that optimization, but this is done before checking whether a suitable index actually exists. Regards, Clemens