Bug #71355 | Strange data type is used for name-related columns in some I_S.INNODB_* tables | ||
---|---|---|---|
Submitted: | 12 Jan 2014 17:22 | Modified: | 13 Jan 2014 5:04 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Information schema | Severity: | S3 (Non-critical) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | information_schema, innodb_sys_foreign, innodb_sys_foreign_cols |
[12 Jan 2014 17:22]
Valeriy Kravchuk
[13 Jan 2014 5:04]
MySQL Verification Team
Hello Valeriy, Thank you for the bug report. Verified as described. Thanks, Umesh
[13 Jan 2014 5:06]
MySQL Verification Team
// With 5.6.15(GA) mysql> select version(); +------------------+ | version() | +------------------+ | 5.6.15-debug-log | +------------------+ 1 row in set (0.04 sec) mysql> mysql> use test Database changed mysql> CREATE TABLE parent ( -> id INT NOT NULL, -> PRIMARY KEY (id) -> ) ENGINE=INNODB; Query OK, 0 rows affected (0.15 sec) mysql> mysql> CREATE TABLE child ( -> id INT, -> parent_id INT, -> INDEX par_ind (parent_id), -> FOREIGN KEY (parent_id) -> REFERENCES parent(id) -> ON DELETE CASCADE -> ) ENGINE=INNODB; Query OK, 0 rows affected (0.04 sec) mysql> desc information_schema.innodb_sys_foreign; +----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ID | varchar(193) | NO | | | | | FOR_NAME | varchar(193) | NO | | | | | REF_NAME | varchar(193) | NO | | | | | N_COLS | int(11) unsigned | NO | | 0 | | | TYPE | int(11) unsigned | NO | | 0 | | +----------+------------------+------+-----+---------+-------+ 5 rows in set (0.00 sec) mysql> select * from information_schema.innodb_sys_foreign; +-------------------+------------+-------------+--------+------+ | ID | FOR_NAME | REF_NAME | N_COLS | TYPE | +-------------------+------------+-------------+--------+------+ | test/child_ibfk_1 | test/child | test/parent | 1 | 1 | +-------------------+------------+-------------+--------+------+ 1 row in set (0.06 sec) mysql> desc information_schema.innodb_sys_foreign_cols; +--------------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+------------------+------+-----+---------+-------+ | ID | varchar(193) | NO | | | | | FOR_COL_NAME | varchar(193) | NO | | | | | REF_COL_NAME | varchar(193) | NO | | | | | POS | int(11) unsigned | NO | | 0 | | +--------------+------------------+------+-----+---------+-------+ 4 rows in set (0.00 sec) mysql> select * from information_schema.innodb_sys_foreign_cols; +-------------------+--------------+--------------+-----+ | ID | FOR_COL_NAME | REF_COL_NAME | POS | +-------------------+--------------+--------------+-----+ | test/child_ibfk_1 | parent_id | id | 0 | +-------------------+--------------+--------------+-----+ 1 row in set (0.00 sec) mysql>
[13 Jan 2014 12:31]
Peter Laursen
Let me guess: The table is UTF8. 64 utf8 characters = up to 64*3 = 192 bytes. It looks like somebody mistook that varchar lengths in table definitions are not specificied using byte-width but character-width. And further added "1" for some weird reason! This table is stored in memory and it is waste of memory as far as I can understand.