Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Pavel Ivanov
> i didn't said this condition should be *replaced* , i said that inequality > should be *added*. then index could limit resultset, but bitwise operator will > still be used, only on hopefully smaller set of data Oh, sorry, I didn't understand you correctly then. But I believe that this condition

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Michal Seliga
Pavel Ivanov wrote: >> change your query a bit when you use bitwise operations, in your case when >> you >> have 'AND col_c&32' you may add 'AND col_c>=32'. now index will be used > > col_c = 64 does pass second condition and doesn't pass first one. ;-) > Bitwise operators cannot be changed so

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Swithun Crowe
Hello PI > change your query a bit when you use bitwise operations, in your case when you PI > have 'AND col_c&32' you may add 'AND col_c>=32'. now index will be used PI col_c = 64 does pass second condition and doesn't pass first one. ;-) PI Bitwise operators cannot be changed so easily to in

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Pavel Ivanov
> change your query a bit when you use bitwise operations, in your case when > you > have 'AND col_c&32' you may add 'AND col_c>=32'. now index will be used col_c = 64 does pass second condition and doesn't pass first one. ;-) Bitwise operators cannot be changed so easily to inequalities. Pave

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Michal Seliga
Daniel Wickes wrote: > I'm trying to optimise some of my queries, and I would like to know if > bitwise operators in terms will still use an index, or if I should be > thinking about moving the more important values to separate columns that > could be checked for equality. > > At the moment, I h

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Pavel Ivanov
> In answer to your question, yes the index is used. You can see instructions > prefixed by Idx that aren't there when the index doesn't exist. I just want to warn you: the index is used but not for finding appropriate value of col_c (as your question seem to imply). It is used only to find appro

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Daniel Wickes
Roger Binns wrote: > SQLite provides you the tools to find out for yourself. In the shell do > '.explain' and then give it your query prefixed with 'EXPLAIN'. You'll get > the virtual db engine code for the query printed out. > ... > In answer to your question, yes the index is used. You can se

Re: [sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Daniel Wickes wrote: > I'm trying to optimise some of my queries, and I would like to know if > bitwise operators in terms will still use an index, SQLite provides you the tools to find out for yourself. In the shell do '.explain' and then give it yo

[sqlite] Will Bitwise Operations Use an Index?

2009-10-09 Thread Daniel Wickes
I'm trying to optimise some of my queries, and I would like to know if bitwise operators in terms will still use an index, or if I should be thinking about moving the more important values to separate columns that could be checked for equality. At the moment, I have an index created much like: