Bug #4539 forget \' and you will wait longer....
Submitted: 13 Jul 2004 18:05 Modified: 13 Jul 2004 21:45
Reporter: bob bedford Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.15 OS:Windows (XP Pro)
Assigned to: Sergei Golubchik CPU Architecture:Any

[13 Jul 2004 18:05] bob bedford
Description:
takes this statement.
select ....
from....
inner join....
where X= value

if X is a char() and value is an integer, then the query tooks 20 seconds
putting 'value' instead of value, the query took 0.018 seconds.

The query is done on big tables, so probably the code cast an int in the char at every line !

Don't know if it can be fixed.

I use InnoDB

Regards.

How to repeat:
any query

Suggested fix:
a cast when the query is analysed, not at every line.
[13 Jul 2004 21:45] Sergei Golubchik
It cannot.

Assume your "value" is 15, so the column values that returns true on

  column=15

could be  "15", "    15", "00015", "  +15", "1.5e1", "000.000015e6", and so on. Remember - they all are strings, and are sorted as strings!
There is no way MySQL can find all these values by using an index, so it has to scan the table (well, it can scan the index, but still scan).

It you write

   column="15"

then MySQL easily picks up rows that contain the string "15" from the index.