-
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,BLOBandTEXTcolumns, is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes.LONGBLOBandLONGTEXTcolumns must be less than 4GB, and the total row length, including alsoBLOBandTEXTcolumns, must be less than 4GB.InnoDBstores the first 768 bytes of aVARCHAR,BLOB, orTEXTcolumn 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
InnoDBlog 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.
-
InnoDBtables do not supportFULLTEXTindexes. -
InnoDBtables do not support spatial column types. -
ANALYZE TABLEcountscardinalityby 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 TABLEmay produce different numbers. This makesANALYZE TABLEfast onInnoDBtables 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 TABLEdoesn't produce values good enough for your particular tables, you can useFORCE INDEXwith your queries to force the usage of a particular index, or setmax_seeks_for_keyto 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,
InnoDBalways 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
mysqldatabase fromMyISAMtoInnoDBtables! 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. -
InnoDBdoes 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 Tstatement,InnoDBmust 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 STATUSalso can be used if an approximate row count is sufficient. See Sección 15.11, “Consejos de afinamiento del rendimiento deInnoDB”. -
For an
AUTO_INCREMENTcolumn, you must always define an index for the table, and that index must contain just theAUTO_INCREMENTcolumn. InMyISAMtables, theAUTO_INCREMENTcolumn may be part of a multi-column index. -
InnoDBdoes not support theAUTO_INCREMENTtable option for setting the initial sequence value in aCREATE TABLEorALTER TABLEstatement. 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,
InnoDBmay reuse an old value for anAUTO_INCREMENTcolumn (that is, a value that was assigned to an old transaction that was rolled back). -
When an
AUTO_INCREMENTcolumn runs out of values,InnoDBwraps aBIGINTto-9223372036854775808andBIGINT UNSIGNEDto1. However,BIGINTvalues 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 beforeBIGINTreached its upper bound. With all other integer type columns, a duplicate-key error results. This is similar to howMyISAMworks, because it is mostly general MySQL behavior and not about any storage engine in particular. -
DELETE FROMtbl_namedoes not regenerate the table but instead deletes all rows, one by one. -
TRUNCATEtbl_nameis mapped toDELETE FROMtbl_nameforInnoDBand doesn't reset theAUTO_INCREMENTcounter. -
SHOW TABLE STATUSdoes not give accurate statistics onInnoDBtables, 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 TABLESoperation 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 anInnoDBtable lock. Older versions of MySQL did not acquireInnoDBtable locks; the old behavior can be selected by settinginnodb_table_locks=0. If noInnoDBtable lock is acquired,LOCK TABLEScompletes even if some records of the tables are being locked by other transactions. -
All
InnoDBlocks held by a transaction are released when the transaction is committed or aborted. Thus, it does not make much sense to invokeLOCK TABLESonInnoDBtables inAUTOCOMMIT=1mode, because the acquiredInnoDBtable locks would be released immediately. -
Sometimes it would be useful to lock further tables in the course of a transaction. Unfortunately,
LOCK TABLESin MySQL performs an implicitCOMMITandUNLOCK TABLES. An InnoDB variant ofLOCK TABLEShas been planned that can be executed in the middle of a transaction. -
The
LOAD TABLE FROM MASTERstatement for setting up replication slave servers does not yet work forInnoDBtables. A workaround is to alter the table toMyISAMon the master, do then the load, and after that alter the master table back toInnoDB. -
The default database page size in
InnoDBis 16KB. By recompiling the code, you can set it to values ranging from 8KB to 64KB. You have to update the values ofUNIV_PAGE_SIZEandUNIV_PAGE_SIZE_SHIFTin theuniv.isource file. -
In MySQL 5.0, triggers are not yet activated by cascaded foreign key actions.