Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Richard Hipp
On Sat, Jun 25, 2011 at 7:25 AM, Luuk wrote: > I create a test database with almost 10 milion rows. > I'm surprised to see that the first SELECT below is much slower than the > sum of the next three SELECTs. > > Can anyone give a hint why this is the case? > > SQLite version 3.7.2 > Enter ".help"

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Simon Slavin
On 25 Jun 2011, at 4:12pm, Black, Michael (IS) wrote: > Can the optimizer recognize these "instant" functions and perhaps lean > towards using them? It already does. That's why max(x) takes no time when you have an index on (x). > Are there cases where this would NOT be good? Theoretically,

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Black, Michael (IS)
cussion of SQLite Database Subject: EXT :Re: [sqlite] question about sqlite aggregate funcitons 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 > o

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Simon Slavin
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 instruction

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Luuk
On 25-06-2011 15:15, Black, Michael (IS) wrote: > OK...I generated 10M ints and imported them. I get times that I would expect. > > select with all 3 is slightly less then the sum of the other 3 individually. > > > > main() > { > int i; > for(i=0;i<1000;i++) { >

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Luuk
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) fro

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Black, Michael (IS)
s-boun...@sqlite.org] on behalf of Black, Michael (IS) [michael.bla...@ngc.com] Sent: Saturday, June 25, 2011 8:15 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] question about sqlite aggregate funcitons OK...I generated 10M ints and imported them. I get times that I would

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Black, Michael (IS)
ior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Luuk [luu...@gmail.com] Sent: Saturday, June 25, 2011 7:37 AM To: sqlite-users@sqlite.org Subject: EXT :Re

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Luuk
l.com] > Sent: Saturday, June 25, 2011 6:25 AM > To: General Discussion of SQLite Database > Subject: EXT :[sqlite] question about sqlite aggregate funcitons > > I create a test database with almost 10 milion rows. > I'm surprised to see that the first SELECT below i

Re: [sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Black, Michael (IS)
m: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Luuk [luu...@gmail.com] Sent: Saturday, June 25, 2011 6:25 AM To: General Discussion of SQLite Database Subject: EXT :[sqlite] question about sqlite aggregate funcitons I create a test database with almost 10 m

[sqlite] question about sqlite aggregate funcitons

2011-06-25 Thread Luuk
I create a test database with almost 10 milion rows. I'm surprised to see that the first SELECT below is much slower than the sum of the next three SELECTs. Can anyone give a hint why this is the case? SQLite version 3.7.2 Enter ".help" for instructions Enter SQL statements terminated with a ";"