From: Rick James Date: July 16 2012 9:03pm Subject: RE: Fwd: Query take too long time - please help! List-Archive: http://lists.mysql.com/mysql/227830 Message-Id: <2E7DD7ADE53B044C8C8BCD9C5829E1EB148892B748@SP2-EX07VS01.ds.corp.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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! >=20 > On 10.07.2012 13:16, Darek Maciera wrote: > > 2012/7/10 Ananda Kumar : > >> can u show the explain plan for your query > >> > > > > Thanks, for reply! > > > > Sure: > > > > mysql> EXPLAIN SELECT * FROM books WHERE > > mysql> LOWER(ksd)=3DLOWER('4204661375'); >=20 > 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. >=20 > Also, how do you know that ksd id unique (as stated in your original > post)? You have no index on it to ensure uniqueness. >=20 > You'll have to find some other way to query the table. >=20 > Best, >=20 > / Carsten >=20 > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql