Steve,
what did explain tell you in either case?

Regards, Frank.

Steve Rapaport wrote:
> 
> I just found this unexpected result, those who know how
> indexing works might understand it but I don't, and it's
> funny:
> 
> I have a large phone listing with over 22 million records.
> The phone number is a string (varchar 16).
> 
> There's an index for the first 8 chars of the phone number.
> 
> Now note the response times when I forget the quotes:
> 
> mysql> select rec_no,phone_no from White where phone_no='0636941';
> +---------+----------+
> | rec_no  | phone_no |
> +---------+----------+
> | 1860796 | 0636941  |
> +---------+----------+
> 1 row in set (0.06 sec)
> 
> mysql> select rec_no,phone_no from White where phone_no=0636941;
> +---------+----------+
> | rec_no  | phone_no |
> +---------+----------+
> | 1860796 | 0636941  |
> +---------+----------+
> 
> 1 row in set (2 min 47.01 sec)
> 
> I would have expected the second query to either work quickly, or to
> fail altogether.
> I am curious how it succeeded, but failed to use the indexing.  I suspect
> that any insight we get from this could help in optimizing db design and
> queries in future.
> 
> Steve
> 
> --
> Steve Rapaport
> World Citizen
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Dr. Frank Ullrich, Netzwerkadministration 
Verlag Heinz Heise GmbH & Co KG, Helstorfer Str. 7, D-30625 Hannover
E-Mail: [EMAIL PROTECTED]
Phone: +49 511 5352 587; FAX: +49 511 5352 538

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to