On 4/17/07, Daniel Kasak <dkasak@stripped> wrote:
> Arun Kumar PG wrote:
> > Guys,
> > I know this is a stupid thing but I wanted to know if we have an index
> > on a
> > column "X" and if i have a query having 10000 OR conditions on the
> > field e.g.
> > where X=10 OR x=12 OR x=13 OR x=15...... so on then will it give any
> > benefits in terms of speed?
> Yes the index still works. I construct queries that have a decent number
> of OR conditions ( I default mine to limit to 100 conditions, all on the
> primary key ), and I get very good performance ( not only from MySQL, by
> the way, this seems to work on a number of different DB servers ). Keep
> in mind the max_packet_size for MySQL ( I think this is the one to watch
> anyway ). If your query exceeds this size, you're in trouble.
> Just for interest, I tried pushing my default to 10,000, then 20,000,
> and I still get amazingly good performance. Cool :) The reason I default
> to 100 is so I get decent performance across slow network connections (
> eg DSL ).
> Daniel Kasak
> IT Developer
> NUS Consulting Group
> Level 5, 77 Pacific Highway
> North Sydney, NSW, Australia 2060
> T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
> email: dkasak@stripped
> website: http://www.nusconsulting.com.au