Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Richard Hipp
On Fri, May 7, 2010 at 5:57 PM, Griggs, Donald wrote: > > Sqlite using a maximum of one index per table per select. > > In order to perform your "OR" select, it must scan every the table. > That information is obsolete as of SQLite version 3.6.8 (2009-01-12). All versions of SQLite over the pas

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/07/2010 04:55 PM, Raeldor wrote: > That's interesting, I'll give that a shot. I've noticed in my dealings with > MS Sql server, that it is very bad at using compound indexes... I hope > sqlite is better! :) Put "explain query plan" in front of

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Raeldor
That's interesting, I'll give that a shot. I've noticed in my dealings with MS Sql server, that it is very bad at using compound indexes... I hope sqlite is better! :) Simon Slavin-3 wrote: > > > On 7 May 2010, at 10:47pm, Raeldor wrote: > >> I have 2 individually indexed fields. I have a s

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Simon Slavin
On 7 May 2010, at 11:14pm, Raeldor wrote: > Seriously... it can only use one index per query? Sure. Because after using the first index it is no longer searching the table, it's searching a big collection of unindexed rows it got from the first search. There's no point in mindlessly making on

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Simon Slavin
On 7 May 2010, at 10:47pm, Raeldor wrote: > I have 2 individually indexed fields. I have a select statement... > > select * from table1 where field1='x' and field2='y' > > this takes about 10 sections, yet if I do... > > select * from table1 where field1='x' > > it's instant, and if i do...

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Raeldor
Btw... does this 'one index' also include indexes used for joining? Thanks Ray Raeldor wrote: > > Hi, > > Seriously... it can only use one index per query? I tried your union > suggestion and it works well, thank you. I had no idea it was limited to > a single index. > > Thanks > Ray > >

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Raeldor
Hi, Seriously... it can only use one index per query? I tried your union suggestion and it works well, thank you. I had no idea it was limited to a single index. Thanks Ray Griggs, Donald-3 wrote: > > Regarding: >select * from table1 where field1='x' or field2='y' > > > Hi, Ray,

Re: [sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Griggs, Donald
Regarding: select * from table1 where field1='x' or field2='y' Hi, Ray, I believe you sent two messages -- the first with "OR" and the second with "AND". Since your subject consistently says "OR" and your last email says "AND" I'll assume you meant "AND". Sqlite using a maximum of o

[sqlite] Very Odd... where field1='' or field2='' is slow

2010-05-07 Thread Raeldor
Hi All, I have 2 individually indexed fields. I have a select statement... select * from table1 where field1='x' and field2='y' this takes about 10 sections, yet if I do... select * from table1 where field1='x' it's instant, and if i do... select * from table1 where field2='y' it's also in