-
A table cannot contain more than 1000 columns.
-
The internal maximum key length is 3500 bytes, but MySQL itself restricts this to 1024 bytes.
-
The maximum row length, except for
VARCHAR
,BLOB
andTEXT
columns, is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes.LONGBLOB
andLONGTEXT
columns must be less than 4GB, and the total row length, including alsoBLOB
andTEXT
columns, must be less than 4GB.InnoDB
stores the first 768 bytes of aVARCHAR
,BLOB
, orTEXT
column in the row, and the rest into separate pages. -
On some older operating systems, data files must be less than 2GB.
-
The combined size of the
InnoDB
log files must be less than 4GB. -
The minimum tablespace size is 10MB. The maximum tablespace size is four billion database pages (64TB). This is also the maximum size for a table.
-
InnoDB
tables do not supportFULLTEXT
indexes. -
InnoDB
tables do not support spatial column types. -
ANALYZE TABLE
countscardinality
by doing 10 random dives to each of the index trees and updating index cardinality estimates accordingly. Note that because these are only estimates, repeated runs ofANALYZE TABLE
may produce different numbers. This makesANALYZE TABLE
fast onInnoDB
tables but not 100% accurate as it doesn't take all rows into account.MySQL uses index cardinality estimates only in join optimization. If some join is not optimized in the right way, you may try using
ANALYZE TABLE
. In the few cases thatANALYZE TABLE
doesn't produce values good enough for your particular tables, you can useFORCE INDEX
with your queries to force the usage of a particular index, or setmax_seeks_for_key
to ensure that MySQL prefers index lookups over table scans. See Sección 5.3.3, “Variables de sistema del servidor”. See Sección A.6, “Cuestiones relacionadas con el optimizados”. -
On Windows,
InnoDB
always stores database and table names internally in lowercase. To move databases in binary format from Unix to Windows or from Windows to Unix, you should have all database and table names in lowercase. -
Warning: Do not convert MySQL system tables in the
mysql
database fromMyISAM
toInnoDB
tables! This is an unsupported operation. If you do this, MySQL does not restart until you restore the old system tables from a backup or re-generate them with the mysql_install_db script. -
InnoDB
does not keep an internal count of rows in a table. (This would actually be somewhat complicated because of multi-versioning.) To process aSELECT COUNT(*) FROM T
statement,InnoDB
must scan an index of the table, which takes some time if the index is not entirely in the buffer pool. To get a fast count, you have to use a counter table you create yourself and let your application update it according to the inserts and deletes it does. If your table does not change often, using the MySQL query cache is a good solution.SHOW TABLE STATUS
also can be used if an approximate row count is sufficient. See Sección 15.11, “Consejos de afinamiento del rendimiento deInnoDB
”. -
For an
AUTO_INCREMENT
column, you must always define an index for the table, and that index must contain just theAUTO_INCREMENT
column. InMyISAM
tables, theAUTO_INCREMENT
column may be part of a multi-column index. -
InnoDB
does not support theAUTO_INCREMENT
table option for setting the initial sequence value in aCREATE TABLE
orALTER TABLE
statement. To set the value withInnoDB
, insert a dummy row with a value one less and delete that dummy row, or insert the first row with an explicit value specified. -
When you restart the MySQL server,
InnoDB
may reuse an old value for anAUTO_INCREMENT
column (that is, a value that was assigned to an old transaction that was rolled back). -
When an
AUTO_INCREMENT
column runs out of values,InnoDB
wraps aBIGINT
to-9223372036854775808
andBIGINT UNSIGNED
to1
. However,BIGINT
values have 64 bits, so do note that if you were to insert one million rows per second, it would still take nearly three hundred thousand years beforeBIGINT
reached its upper bound. With all other integer type columns, a duplicate-key error results. This is similar to howMyISAM
works, because it is mostly general MySQL behavior and not about any storage engine in particular. -
DELETE FROM
tbl_name
does not regenerate the table but instead deletes all rows, one by one. -
TRUNCATE
tbl_name
is mapped toDELETE FROM
tbl_name
forInnoDB
and doesn't reset theAUTO_INCREMENT
counter. -
SHOW TABLE STATUS
does not give accurate statistics onInnoDB
tables, except for the physical size reserved by the table. The row count is only a rough estimate used in SQL optimization. -
In MySQL 5.0, the MySQL
LOCK TABLES
operation acquires two locks on each table ifinnodb_table_locks=1
, with 1 being the default.) In addition to a table lock on the MySQL layer, it also acquires anInnoDB
table lock. Older versions of MySQL did not acquireInnoDB
table locks; the old behavior can be selected by settinginnodb_table_locks=0
. If noInnoDB
table lock is acquired,LOCK TABLES
completes even if some records of the tables are being locked by other transactions. -
All
InnoDB
locks held by a transaction are released when the transaction is committed or aborted. Thus, it does not make much sense to invokeLOCK TABLES
onInnoDB
tables inAUTOCOMMIT=1
mode, because the acquiredInnoDB
table locks would be released immediately. -
Sometimes it would be useful to lock further tables in the course of a transaction. Unfortunately,
LOCK TABLES
in MySQL performs an implicitCOMMIT
andUNLOCK TABLES
. An InnoDB variant ofLOCK TABLES
has been planned that can be executed in the middle of a transaction. -
The
LOAD TABLE FROM MASTER
statement for setting up replication slave servers does not yet work forInnoDB
tables. A workaround is to alter the table toMyISAM
on the master, do then the load, and after that alter the master table back toInnoDB
. -
The default database page size in
InnoDB
is 16KB. By recompiling the code, you can set it to values ranging from 8KB to 64KB. You have to update the values ofUNIV_PAGE_SIZE
andUNIV_PAGE_SIZE_SHIFT
in theuniv.i
source file. -
In MySQL 5.0, triggers are not yet activated by cascaded foreign key actions.