Bug #6751 The maximum key size is still 1024 bytes on InnoDB (mysql 4.1.7)
Submitted: 22 Nov 2004 15:07 Modified: 22 Nov 2004 18:04
Reporter: Janne Hietamäki Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:4.1.7 OS:Linux (linux / Fedora core 3)
Assigned to: CPU Architecture:Any

[22 Nov 2004 15:07] Janne Hietamäki
Description:
Page http://dev.mysql.com/doc/mysql/en/InnoDB_restrictions.html says "The maximum key length is 3500 bytes (1024 bytes before MySQL 4.1.2)." but the maximum size seems still to be 1024 bytes.

How to repeat:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 87 to server version: 4.1.7-standard-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table test (value varchar(200),value2 varchar(200), value3 varchar(200)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Query OK, 0 rows affected (0.06 sec)

mysql> create index testidx on test (value,value2,value3);
ERROR 1071 (42000): Specified key was too long; max key length is 1024 bytes

Suggested fix:
Increase max key length to 3500 bytes as documented.
[22 Nov 2004 18:04] Heikki Tuuri
Hi!

Thank you for the bug report. I have now updated the manual. Unfortunately, the global MySQL limit is still 1024 bytes per key. A problem in raising it is that MySQL stores key values in the stack, and stack consumption must be kept very low that you can create 10 000 connections = 10 000 threads in a 32-bit computer.

The InnoDB internal limit is 3500 bytes.

unireg.h:53:#define MAX_KEY_LENGTH 1024                 /* max possible key */

handler.h:
  uint max_key_length() const
  { return min(MAX_KEY_LENGTH, max_supported_key_length()); }
  uint max_key_part_length() const
  { return min(MAX_KEY_LENGTH, max_supported_key_part_length()); }

ha_innodb.h:

        uint max_supported_key_length() const { return 3500; }
        uint max_supported_key_part_length() const { return 3500; }