MySQL Forums
Forum List  »  Optimizer & Parser

Re: Index not being used
Posted by: Patrick O'Loughlin
Date: April 21, 2009 02:55AM

Hi Rick,
Been a bit busy for the past week, so I was unable to get back to this until now.

As I was getting the information you requested, I appear to have found the issue.
The field client_id is stored as a VARCHAR.
When I wrote the SELECT for optimising, i failed to put quotes around the value of client_id I was limiting my results to.
That is, I had
WHERE client_id = 51
instead of
WHERE client_id = '51'

So MySQL was interpreting the value as a number instead of a string, and it couldn't use the index to search because of that.

Thanks for your time and help,
Paddy



Edited 1 time(s). Last edit at 04/21/2009 05:01AM by Patrick O'Loughlin.

Options: ReplyQuote


Subject
Views
Written By
Posted
6710
April 14, 2009 05:18AM
3265
April 15, 2009 10:41AM
Re: Index not being used
3038
April 21, 2009 02:55AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.