* Steve Rapaport
Regarding integer/string conversions:
select rec_no,phone_no from White where phone_no=0636941;
versus
select rec_no,phone_no from White where phone_no='0636941';
> Seems naive to me, since the datatype of the field is known, why
> not convert the constant instead? The
Anvar Hussain K.M. writes:
> Hi,
> Since the equality test is for a number, the phone_no field of every row of
> the table
> is converted into a number first and tested for the equality. This makes it
> impossible
> to use the character index and so forces the full table scan.
>
> If it were us
Dr. Frank Ullrich wrote:
> Steve,
> what did explain tell you in either case?
Good question Dr. Ullrich.
mysql> explain select rec_no,phone_no from White where phone_no=0636941;
+---+--+---+--+-+--+--++
| table | type | possible_keys |
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 numb
Hi,
Since the equality test is for a number, the phone_no field of every row of
the table
is converted into a number first and tested for the equality. This makes it
impossible
to use the character index and so forces the full table scan.
If it were using the index then, I think, it cannot find
* Steve Rapaport
> 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