Index only sometimes used

2002-03-20 Thread Steve Gardner
Hi All Could someone explain to me why an index in a select I am doing is only sometimes used. The select I do is a complex one with multiple tables, and when it uses the index it takes 1.5 seconds, but when it dosnt it takes 1 min and 25-50 seconds. I have simplified it down and founed the

Re: Index only sometimes used

2002-03-20 Thread Paul DuBois
At 16:31 + 3/20/02, Steve Gardner wrote: Hi All Could someone explain to me why an index in a select I am doing is only sometimes used. The select I do is a complex one with multiple tables, and when it uses the index it takes 1.5 seconds, but when it dosnt it takes 1 min and 25-50 seconds.

Re: Index only sometimes used

2002-03-20 Thread nigel wood
On Wed, 20 Mar 2002, Steve Gardner wrote: Hi All Could someone explain to me why an index in a select I am doing is only sometimes used. mysql explain select * from mailstat where domain_id in(2); +--+--+---+--+-+--+-+--- -+ |

Re: Index only sometimes used

2002-03-20 Thread Gerald Clark
If more than a third of the rows would be selected, it is faster not to use the index. Over 2 million records match the '2'. How many are there total? Steve Gardner wrote: Hi All Could someone explain to me why an index in a select I am doing is only sometimes used. The select I do is a

Index only sometimes used

2002-03-20 Thread Victoria Reznichenko
Steve, Wednesday, March 20, 2002, 6:31:09 PM, you wrote: SG Could someone explain to me why an index in a select I am doing is only SG sometimes used. SG The select I do is a complex one with multiple tables, and when it uses the SG index it takes 1.5 seconds, but when it dosnt it takes 1 min

Fw: Index only sometimes used

2002-03-20 Thread Steve Gardner
Hi Again Thanks for all the responces Check the manual section on the query optimiser,.I seem to remember that if MySQL has to check more that some percentage of a table (30% ?) the optimiser guesses it can search the entire table just as quickly. Someone please correct my if I'm wrong.