If the collation for ksd in ..._ci, then it is "case-insensitive", and you can get rid of
both calls to LOWER().
> -----Original Message-----
> From: Carsten Pedersen [mailto:carsten@stripped]
> Sent: Tuesday, July 10, 2012 11:22 AM
> To: Darek Maciera
> Cc: mysql@stripped
> Subject: Re: Fwd: Query take too long time - please help!
> On 10.07.2012 13:16, Darek Maciera wrote:
> > 2012/7/10 Ananda Kumar <anandkl@stripped>:
> >> can u show the explain plan for your query
> > Thanks, for reply!
> > Sure:
> > mysql> EXPLAIN SELECT * FROM books WHERE
> > mysql> LOWER(ksd)=LOWER('4204661375');
> That's definitely not the query you showed the first time around. The
> query you're showing here will force a table scan to calculate
> LOWER(ksd) for every single row.
> Also, how do you know that ksd id unique (as stated in your original
> post)? You have no index on it to ensure uniqueness.
> You'll have to find some other way to query the table.
> / Carsten
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql