mysql error 1114_ERROR 1114 (HY000): The table 'test1' is full 的解决

今天执行sql碰到 1114的错误,如下:

mysql> insert into test1 select * from test;

Query OK, 1778 rows affected (0.06 sec)

Records: 1778  Duplicates: 0  Warnings: 0

mysql> insert into test1 select * from test;

ERROR 1114 (HY000): The table 'test1' is full

查看官方的文档,并没有答案,里面说到操作系统文件的限制引起了这个错误,可以理解,操作系统单个文件大小最大是2G,那么采用innodb_file_per_table=on 时,会把一个表数据创建在一个文件中,那么这个表数据的大小只能是2G了。

http://dev.mysql.com/doc/refman/5.7/en/full-table.html

问题是我的表没有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还是报错。

根据网上的资料,修改my.cnf文件,然后重新启动:

tmp_table_size = 256M

max_heap_table_size = 256M

再次执行就可以了

mysql> insert into test2 select * from test2;

Query OK, 9216 rows affected (1.22 sec)

Records: 9216  Duplicates: 0  Warnings: 0

此时表的最大长度也变为 256M了。

mysql> select * from information_schema.tables where table_name='test2' \G

*************************** 1. row ***************************

TABLE_CATALOG: def

TABLE_SCHEMA: test

TABLE_NAME: test2

TABLE_TYPE: BASE TABLE

ENGINE: MEMORY

VERSION: 10

ROW_FORMAT: Fixed

TABLE_ROWS: 18432

AVG_ROW_LENGTH: 9440

DATA_LENGTH: 174807384

MAX_DATA_LENGTH: 268313120

INDEX_LENGTH: 0

DATA_FREE: 0

AUTO_INCREMENT: NULL

CREATE_TIME: 2016-09-19 14:37:29

UPDATE_TIME: NULL

CHECK_TIME: NULL

TABLE_COLLATION: utf8_general_ci

CHECKSUM: NULL

CREATE_OPTIONS:

TABLE_COMMENT:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值