Re: [sqlite] EXT :Re: question about sqlite aggregate funcitons

2011-06-25 Thread Simon Slavin
On 25 Jun 2011, at 7:14pm, Black, Michael (IS) wrote: > I guess my point is why doesn't the optimizer recognize the almost-zero cost > of min/max in the compound query? It assumes instead to do it all in one scan. Because it's almost impossible to optimize sub-SELECTs. You pretty-much have

Re: [sqlite] EXT :Re: question about sqlite aggregate funcitons

2011-06-25 Thread Luuk
On 25-06-2011 20:14, Black, Michael (IS) wrote: > So these two queries should be equal in speed and plan: > > > > > > select * from (select min(i) from test) as a,(select max(i) from > test) as b, (select count(i) from test) as c; select > min(i),max(i),count(i) from test; and, to make the

Re: [sqlite] EXT :Re: question about sqlite aggregate funcitons

2011-06-25 Thread Black, Michael (IS)
I guess my point is why doesn't the optimizer recognize the almost-zero cost of min/max in the compound query? It assumes instead to do it all in one scan. So these two queries should be equal in speed and plan: select * from (select min(i) from test) as a,(select max(i) from test) as b,