List:General Discussion« Previous MessageNext Message »
From:Stephen Brownlow Date:May 20 2002 5:12am
Subject:[7241] Indexes on columns that are declared differently?
View as plain text  
The MySQL online manual says that MySQL cannot use indexes efficiently
unless the columns have the same type and the same length.

I can see no release notes that this problem has been fixed.

My question: Is this still a problem?

Here is the extract from the latest manual:
7.29 EXPLAIN Syntax (Get Information About a SELECT)
------------------------------
One problem here is that MySQL can't (yet) use indexes on columns
efficiently if they are declared differently. In this context, VARCHAR and
CHAR are the same unless they are declared as different lengths. Because
tt.ActualPC is declared as CHAR(10) and et.EMPLOYID is declared as CHAR(15),
there is a length mismatch.

To fix this disparity between column lengths, use ALTER TABLE to lengthen
ActualPC from 10 characters to 15 characters:

mysql> ALTER TABLE tt MODIFY ActualPC VARCHAR(15);
---------------------------------

Thanks,
Stephen


Thread
[7241] Indexes on columns that are declared differently?Stephen Brownlow20 May
  • Re: [7241] Indexes on columns that are declared differently?Dan Nelson20 May
Re: [7241] Indexes on columns that are declared differently?Stephen Brownlow27 May