The attribute KEY_BLOCK_SIZE is permitted
only when ROW_FORMAT is specified as
COMPRESSED or is omitted. Specifying a
KEY_BLOCK_SIZE with any other
ROW_FORMAT generates a warning that you can
view with SHOW WARNINGS. However, the table
is non-compressed; the specified
KEY_BLOCK_SIZE is ignored).
| Level | Code | Message |
|---|---|---|
| Warning | 1478 | InnoDB: ignoring KEY_BLOCK_SIZE= |
If you are running in InnoDB strict mode, the combination of a
KEY_BLOCK_SIZE with any
ROW_FORMAT other than
COMPRESSED generates an error, not a warning,
and the table is not created.
Table 3.1, “Meaning of CREATE TABLE and
ALTER TABLE options”
summarizes how the various options on
CREATE TABLE and
ALTER TABLE are handled.
Table 3.1. Meaning of CREATE TABLE and
ALTER TABLE options
| Option | Usage | Description |
|---|---|---|
ROW_FORMAT=REDUNDANT | Storage format used prior to MySQL 5.0.3 | Less efficient than ROW_FORMAT=COMPACT; for backward
compatibility |
ROW_FORMAT=COMPACT | Default storage format since MySQL 5.0.3 | Stores a prefix of 768 bytes of long column values in the clustered index page, with the remaining bytes stored in an overflow page |
ROW_FORMAT=DYNAMIC | Available only with
innodb_file_format=Barracuda | Store values within the clustered index page if they fit; if not, stores only a 20-byte pointer to an overflow page (no prefix) |
ROW_FORMAT=COMPRESSED | Available only with
innodb_file_format=Barracuda | Compresses the table and indexes using zlib to default compressed page
size of 8K bytes; implies
ROW_FORMAT=DYNAMIC |
KEY_BLOCK_SIZE= | Available only with
innodb_file_format=Barracuda | Specifies compressed page size of 1, 2, 4, 8 or 16 kilobytes; implies
ROW_FORMAT=DYNAMIC and
ROW_FORMAT=COMPRESSED |
Table 3.2, “CREATE/ALTER TABLE Warnings and Errors when InnoDB
Strict Mode is OFF”
summarizes error conditions that occur with certain combinations
of configuration parameters and options on the
CREATE TABLE or
ALTER TABLE statements, and how
the options appear in the output of SHOW TABLE
STATUS.
When InnoDB strict mode is OFF, InnoDB
creates or alters the table, but may ignore certain settings, as
shown below. You can see the warning messages in the MySQL error
log. When InnoDB strict mode is ON, these
specified combinations of options generate errors, and the table
is not created or altered. You can see the full description of
the error condition with SHOW ERRORS. For
example:
mysql>CREATE TABLE x (id INT PRIMARY KEY, c INT)->ENGINE=INNODB KEY_BLOCK_SIZE=33333;ERROR 1005 (HY000): Can't create table 'test.x' (errno: 1478) mysql>SHOW ERRORS;+-------+------+-------------------------------------------+ | Level | Code | Message | +-------+------+-------------------------------------------+ | Error | 1478 | InnoDB: invalid KEY_BLOCK_SIZE=33333. | | Error | 1005 | Can't create table 'test.x' (errno: 1478) | +-------+------+-------------------------------------------+ 2 rows in set (0.00 sec)
Table 3.2. CREATE/ALTER TABLE Warnings and Errors when InnoDB
Strict Mode is OFF
| Syntax | Warning or Error Condition | Resulting ROW_FORMAT, as shown in SHOW TABLE
STATUS |
|---|---|---|
ROW_FORMAT=REDUNDANT | None | REDUNDANT |
ROW_FORMAT=COMPACT | None | COMPACT |
ROW_FORMAT=COMPRESSED or
ROW_FORMAT=DYNAMIC or
KEY_BLOCK_SIZE is specified | Ignored unless both
innodb_file_format=Barracuda
and
innodb_file_per_table
are enabled | COMPACT |
Invalid KEY_BLOCK_SIZE is specified (not 1, 2, 4, 8
or 16) | KEY_BLOCK_SIZE is ignored | the requested one, or COMPACT by default |
ROW_FORMAT=COMPRESSED and valid
KEY_BLOCK_SIZE are specified | None; KEY_BLOCK_SIZE specified is used, not the 8K
default | COMPRESSED |
KEY_BLOCK_SIZE is specified with
REDUNDANT, COMPACT
or DYNAMIC row format | KEY_BLOCK_SIZE is ignored | REDUNDANT, COMPACT or
DYNAMIC |
ROW_FORMAT is not one of
REDUNDANT,
COMPACT, DYNAMIC
or COMPRESSED | Ignored if recognized by the MySQL parser. Otherwise, an error is issued. | COMPACT or N/A |
When InnoDB strict mode is ON
(innodb_strict_mode=1), the InnoDB storage engine
rejects invalid ROW_FORMAT or
KEY_BLOCK_SIZE parameters. For compatibility
with earlier versions of InnoDB, strict mode is not enabled by
default; instead, InnoDB issues warnings (not errors) for
ignored invalid parameters.
Note that it is not possible to see the chosen
KEY_BLOCK_SIZE using SHOW TABLE
STATUS. The statement SHOW CREATE
TABLE displays the KEY_BLOCK_SIZE
(even if it was ignored by InnoDB). The real compressed page
size inside InnoDB cannot be displayed by MySQL.

User Comments
Add your own comment.