Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Dan Kennedy
On Jan 21, 2010, at 1:54 AM, Pavel Ivanov wrote: >> Why the difference in search time between searching individually and >> searching together? > > Apparently SQLite is not smart enough to optimize the search for both > min and max to make double entrance to the index - first from the >

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Robert Citek
On Wed, Jan 20, 2010 at 1:54 PM, Pavel Ivanov wrote: >> Why the difference in search time between searching individually and >> searching together? > > Apparently SQLite is not smart enough to optimize the search for both > min and max to make double entrance to the index -

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Pavel Ivanov
> Why the difference in search time between searching individually and > searching together? Apparently SQLite is not smart enough to optimize the search for both min and max to make double entrance to the index - first from the beginning, then from the end. It does search through the full index

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Robert Citek
On Wed, Jan 20, 2010 at 8:52 AM, Max Vlasov wrote: > I thought at the first moment that Pavel's suggestion on using extra index > is very "expensive" in terms of megabytes on the disk, but despite this > drawback it's actually more robust. For my own curiosity I created a

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Robert Citek
On Wed, Jan 20, 2010 at 8:52 AM, Max Vlasov wrote: >> One of many ways would be to precompute the min/max into a separate >> table and then query that table whenever you need the min/max. > > I thought at the first moment that Pavel's suggestion on using extra index > is

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Max Vlasov
> > > > One of many ways would be to precompute the min/max into a separate > table and then query that table whenever you need the min/max. > Only if one have full control about how the data changes what with so widespread format as sqlite almost always not the case. I mean without triggers you

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread Robert Citek
> On Wed, Jan 20, 2010 at 6:24 PM, hi wrote: >> For my application I am storing about "1770" rows into sqlite table, >> and when taking 'min' or 'max' it takes about ~7 to 10 seconds. >> >> Can you please suggest effective ways to get min/max values. How are you

Re: [sqlite] fastest way to get the min/max

2010-01-20 Thread hi
Sorry for the wrong subject: On Wed, Jan 20, 2010 at 6:24 PM, hi wrote: > Hi, > > For my application I am storing about "1770" rows into sqlite table, > and when taking 'min' or 'max' it takes about ~7 to 10 seconds. > > Can you please suggest effective ways to get