Mysql 优化须知 InnoDB 限制

https://dev.mysql.com/doc/refman/5.6/en/innodb-limits.html

  • 通常,对于大于1TB的表,建议将表划分为多个表空间文件。

 

  1. MYSQL一个表最多可以包含4096列,innodb 最多1017列、65,535字节的最大行大小限制

mysql> CREATE TABLE t (a VARCHAR(10000), b VARCHAR(10000),c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000),   f VARCHAR(10000), g VARCHAR(6000)) ENGINE=InnoDB CHARACTER SET latin1;

ERROR 1118 (42000): Row size too large. The maximum row size for the used

table type, not counting BLOBs, is 65535. This includes storage overhead,

check the manual. You have to change some columns to TEXT or BLOBs

2.一个表最多可以包含64个

3.多列索引最多允许16列。超过限制将返回错误

4.

InnoDB页面大小

最大表空间大小

4KB

16TB

8KB

32TB

16KB

64TB

  1. Char 最大255、varchar 最大 65533(要留2字节存长度)
  2. InnoDB将行大小(用于数据库页面本地存储的数据)限制为略小于数据库页面的一半。

例如,对于默认的16KB InnoDB页面大小,最大行大小略小于8KB ,这由innodb_page_size 配置选项定义。

你可能感兴趣的:(SQL)