[sqlite] which of these is faster?

2014-03-13 Thread Stephan Beal
Hi, all, i know this is probably splitting hairs, and i ask only out of curiosity, not because i'm looking to optimize at this level... Given a Fossil repository db (namely the event.mtime value, a Julian Day), which of the following is faster for finding the min/max value of that field: SELECT

Re: [sqlite] which of these is faster?

2014-03-13 Thread Andreas Kupries
On Thu, Mar 13, 2014 at 11:37 AM, Stephan Beal wrote: > Hi, all, > > i know this is probably splitting hairs, and i ask only out of curiosity, > not because i'm looking to optimize at this level... > > Given a Fossil repository db (namely the event.mtime value, a Julian Day), > which of the follow

Re: [sqlite] which of these is faster?

2014-03-13 Thread Stephan Beal
On Thu, Mar 13, 2014 at 7:50 PM, Andreas Kupries wrote: > WIBNI regardless of which form is faster, the engine would detect and > rewrite the slower into the other ? > i wouldn't quite expect the engine to figure that out, but of course would be happy if it could. > Note: Which is faster might

Re: [sqlite] which of these is faster?

2014-03-13 Thread Richard Hipp
On Thu, Mar 13, 2014 at 2:37 PM, Stephan Beal wrote: > Hi, all, > > i know this is probably splitting hairs, and i ask only out of curiosity, > not because i'm looking to optimize at this level... > > Given a Fossil repository db (namely the event.mtime value, a Julian Day), > which of the follow

Re: [sqlite] which of these is faster?

2014-03-14 Thread Max Vlasov
On Thu, Mar 13, 2014 at 11:06 PM, Richard Hipp wrote: > > Once you do that, you'll see that the opcode sequence is only slightly > different between the two. They should both run at about the same speed. > I doubt you'll be able to measure the difference. > > Actually a comparatively long (10,0

Re: [sqlite] which of these is faster?

2014-03-14 Thread Richard Hipp
On Fri, Mar 14, 2014 at 8:41 AM, Max Vlasov wrote: > On Thu, Mar 13, 2014 at 11:06 PM, Richard Hipp wrote: > > > > > Once you do that, you'll see that the opcode sequence is only slightly > > different between the two. They should both run at about the same speed. > > I doubt you'll be able to

Re: [sqlite] which of these is faster?

2014-03-14 Thread Max Vlasov
On Fri, Mar 14, 2014 at 4:51 PM, Richard Hipp wrote: >> > In the original problem, there was already an index on the term for which > the min() was requested. >. > Whit your CTE-generated random integers, there is not an index on the > values. So "SELECT min(x) FROM..." does a linear search