问题是我的表没有2G: mysql> select * from information_schema.tables where table_name='test' /G *************************** 1. row *************************** TABLE_CATALOG: def TABLE_SCHEMA: test TABLE_NAME: test TABLE_TYPE: BASE TABLE ENGINE: MEMORY VERSION: 10 ROW_FORMAT: Fixed TABLE_ROWS: 1778 AVG_ROW_LENGTH: 9440 DATA_LENGTH: 16855944 MAX_DATA_LENGTH: 16765440 INDEX_LENGTH: 0 DATA_FREE: 0 AUTO_INCREMENT: NULL CREATE_TIME: 2016-09-19 13:45:37 UPDATE_TIME: NULL CHECK_TIME: NULL TABLE_COLLATION: utf8_general_ci CHECKSUM: NULL CREATE_OPTIONS: TABLE_COMMENT: 1 row in set (0.00 sec)
大约16M, 另一个有用的信息是这个表的存储引擎是 MEMORY. 这个是由于 create table test like information_schema.tables, create table test1 like test; 而information_schema.tables是tables表是memory存储引擎所致。
而 memory 的大小受到 'max_heap_table_size' 参数影响 mysql> show variables like 'max_heap_table_size'; +---------------------+----------+ | Variable_name | Value | +---------------------+----------+ | max_heap_table_size | 16777216 | +---------------------+----------+
修改此参数大小验证一下: set max_heap_table_size=167772160 还是报错。