Digital Type
Date Type
String type
CHAR和VARCHAR
The number of columns and rows table size limit
MySQL hard limit for each table 4096, but for a given table, the maximum value may be less effective. The exact column limit depends on several factors:
Limit the maximum size of the table row number of columns (and possibly size), because the total length of all columns can not exceed this size.
Each column storage requirements limit the maximum number of columns for a given row size. Certain types of data storage requirements depend on factors storage engine, storage format, and character set.
Storage engine may impose additional restrictions to limit the number of table columns. For example, each table to limit InnoDB 1017.
Even more internal storage engine supports row, MySQL table to limit the maximum row size of 65,535 bytes. BLOB and TEXT columns limited only contribution 9-12 bytes line size, because the rest of their content stored separately from the row.
InnoDB provided on innodb_page_size (4KB, 8KB, 16KB, and 32KB), the maximum row size slightly smaller than half a page table. For example, for the default 16KB InnoDB page size, the maximum row size slightly smaller than 8KB.
such as:
-- 此时最大行大小为66000,大于规定的65535 CREATE TABLE `test_max_row_size` ( a VARCHAR(10000), b VARCHAR(10000), c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000), f VARCHAR(10000), g VARCHAR(6000) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 > 1118 - 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 > 时间: 0.004s
Error because the maximum row size limitation is shared by all columns, rather than restrictions on individual columns.
BINARY和VARBINARY
BLOB and TEXT
ENUM and SET
- SET type, the maximum number of elements 64 to the CREATE TABLE `test_set` ( A the SET ( 'A001', 'A002', 'A003', 'A004', 'A005', 'A006', 'A007', ' a008 ',' a009 ',' a0010 ',' a0011 ',' a0012 ',' a0013 ',' a0014 ',' a0015 ',' a0016 ',' a0017 ',' a0018 ',' a0019 ',' a0020 ' , 'a0021', 'a0022' , 'a0023', 'a0024', 'a0025', 'a0026', 'a0027', 'a0028', 'a0029', 'a0030', 'a0031', 'a0032', ' a0033 ',' a0034 ',' a0035 ',' a0036 ',' a0037 ',' a0038 ',' a0039 ',' a0040 ',' a0041 ',' a0042 ',' a0043 ',' a0044 ',' a0045 ' , 'a0046', 'a0047' , 'a0048', 'a0049','a0050','a0051','a0052','a0053','a0054','a0055','a0056','a0057','a0058','a0059','a0060','a0061','a0062','a0063','a0064') ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
These two types of test
CREATE TABLE `test_enum_set` ( a SET('A','B','C'), b ENUM('男','女') ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO test_enum_set VALUES('A,B','男') > Affected rows: 1 > 时间: 0.009s
If you insert the value is not set list, error
INSERT INTO test_enum_set VALUES('D','男') > 1265 - Data truncated for column 'a' at row 1 > 时间: 0s
If you insert the value of the column is not enum, but also an error
INSERT INTO test_enum_set VALUES ( 'C' , ' Simon') > 1265 - for the Data truncated column 'B'. 1 AT Row > Time: 0s
For the set, the insert will filter out duplicate, otherwise how can they set it
INSERT INTO test_enum_set VALUES ( 'A, A, A', ' F') > the Affected rows:. 1 > Time: 0.008s
Data type storage requirements
Digital front type already mentioned, is not repeated here.
Time Type
Enumeration and collection types
If you want to form file, I've packed up: https://github.com/Mysakura/DataFiles
That .pos files can be imported https://www.processon.com/ view