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