15.16. Restricciones de las tablas InnoDB

MySQL 5.0

15.16. Restricciones de las tablas InnoDB

  • 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 , and columns, is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes. and columns must be less than 4GB, and the total row length, including also and columns, must be less than 4GB. stores the first 768 bytes of a , , or 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 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.

  • tables do not support indexes.

  • tables do not support spatial column types.

  • counts 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 of may produce different numbers. This makes fast on 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 . In the few cases that doesn't produce values good enough for your particular tables, you can use with your queries to force the usage of a particular index, or set 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, 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 database from to 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.

  • does not keep an internal count of rows in a table. (This would actually be somewhat complicated because of multi-versioning.) To process a statement, 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. also can be used if an approximate row count is sufficient. See Sección 15.11, “Consejos de afinamiento del rendimiento de .

  • For an column, you must always define an index for the table, and that index must contain just the column. In tables, the column may be part of a multi-column index.

  • does not support the table option for setting the initial sequence value in a or statement. To set the value with , 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, may reuse an old value for an column (that is, a value that was assigned to an old transaction that was rolled back).

  • When an column runs out of values, wraps a to and to . However, 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 before reached its upper bound. With all other integer type columns, a duplicate-key error results. This is similar to how works, because it is mostly general MySQL behavior and not about any storage engine in particular.

  • does not regenerate the table but instead deletes all rows, one by one.

  • is mapped to for and doesn't reset the counter.

  • does not give accurate statistics on 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 operation acquires two locks on each table if , with 1 being the default.) In addition to a table lock on the MySQL layer, it also acquires an table lock. Older versions of MySQL did not acquire table locks; the old behavior can be selected by setting . If no table lock is acquired, completes even if some records of the tables are being locked by other transactions.

  • All locks held by a transaction are released when the transaction is committed or aborted. Thus, it does not make much sense to invoke on tables in mode, because the acquired table locks would be released immediately.

  • Sometimes it would be useful to lock further tables in the course of a transaction. Unfortunately, in MySQL performs an implicit and . An InnoDB variant of has been planned that can be executed in the middle of a transaction.

  • The statement for setting up replication slave servers does not yet work for tables. A workaround is to alter the table to on the master, do then the load, and after that alter the master table back to .

  • The default database page size in is 16KB. By recompiling the code, you can set it to values ranging from 8KB to 64KB. You have to update the values of and in the source file.

  • In MySQL 5.0, triggers are not yet activated by cascaded foreign key actions.