mysql查询失败,但没有清理磁盘空间

标签 mysql join

我试图运行以下语句,希望创建两个现有表的连接。

create table CRS_PAIR
select concat_ws(',', a.TESTING_ID, b.TRAINING_ID, a.TESTING_C) as k, concat_ws(',', a.YTG, b.YTG) as YTG
from CRS_TESTING a, CRS_TRAINING b
where a.TESTING_C=b.TRAINING_C;

目前这两个表的大小是:

mysql> SELECT table_name, round(((data_length + index_length) / (1024*1024)),2) as "size in megs" FROM information_schema.tables WHERE table_schema = "crs";
+----------------+---------------+
| table_name     | size in megs  |
+----------------+---------------+
| CRS_TESTING    |         36.59 |
| CRS_TRAINING   |        202.92 |
+----------------+---------------+

一天多一点后,查询完成,我得到了以下结果。

140330  2:53:50 [ERROR] /usr/sbin/mysqld: The table 'CRS_PAIR' is full
140330  2:53:54  InnoDB: ERROR: the age of the last checkpoint is 9434006,
InnoDB: which exceeds the log group capacity 9433498.
InnoDB: If you are using big BLOB or TEXT rows, you must set the
InnoDB: combined size of log files at least 10 times bigger than the
InnoDB: largest such row.

原来/var/lib/mysql的磁盘空间已经增长到246GB,磁盘空间用完了。但是,出于某种原因,CRS_PAIR 表没有出现在 shell 中。即使我试图获取所有数据库的大小时。

mysql> SELECT table_schema "Data Base Name", sum( data_length + index_length ) / (1024 * 1024) "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ; 
+--------------------+----------------------+
| Data Base Name     | Data Base Size in MB |
+--------------------+----------------------+
| crs                |            1426.4531 |
| information_schema |               0.0088 |
| mysql              |               0.6453 |
| performance_schema |               0.0000 |
+--------------------+----------------------+
4 rows in set (0.74 sec)

这是显示表命令。

mysql> show tables;
+----------------+
| Tables_in_crs  |
+----------------+
| CRS_TESTING    |
| CRS_TRAINING   |
 some other tables
+----------------+
9 rows in set (0.00 sec)

CRS_PAIR 不存在。

请问有没有人能帮我弄清楚这个神秘的表去了哪里,以便我清理磁盘空间?

最佳答案

如果您没有设置innodb_file_per_table(或设置为 0),那么 InnoDB 会将您所有的 InnoDB 表放入池文件(通常是 /var/lib/mysql/ibdata1),根据需要扩展它以适应写入的数据。但是,引擎从不进行任何空间回收。这意味着 ibdata1 文件总是增长,它永远不会缩小。

减小此文件大小的唯一方法是备份数据,关闭 MySQL,删除它,重新启动 MySQL,然后重新加载数据。

关于mysql查询失败,但没有清理磁盘空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22751740/

相关文章:

entity-framework - 使用 EF Code First 与联接表建立一对多关系

cakephp - 如何在 cakephp 连接数组中写入顺序和限制

php - 用户内容 : two tables with columns of the same name or join?

sql-server - 使用 COALESCE FULL OUTER JOIN 复制行

php - mysql根据情况切换到替代表

Mysql 触发器插入记录或更新记录(如果已存在)?

javascript - 使用在水线/sails 中查找来获取更少的字段

mysqlimport --- 附加到带有索引的表

php - Sqlite 内部联接不起作用 :s

mysql - 根据主键在表上以正确的顺序插入行。