information_schema.TABLES.DATA_FREE 在 MySQL 中是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9731853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:34:19  来源:igfitidea点击:

What does information_schema.TABLES.DATA_FREE mean in MySQL?

mysql

提问by bananaaus

I am not entirely sure what information_schema.TABLES.DATA_FREE means in MySQL.

我不完全确定 information_schema.TABLES.DATA_FREE 在 MySQL 中的含义。

Can someone please help me understand it?

有人可以帮我理解吗?

Thank you.

谢谢你。

回答by Ashwin A

DATA_FREE- The number of allocated but unused bytes. It is the size of the database files compared to the data stored in the database files. PHPMyAdmin shows this information as 'Overhead in tables'.

DATA_FREE- 已分配但未使用的字节数。它是数据库文件与存储在数据库文件中的数据相比的大小。PHPMyAdmin 将此信息显示为“表中的开销”。

However for InnoDB this is important- "InnoDB tables report the free space of the tablespace to which the table belongs. For a table located in the shared tablespace, this is the free space of the shared tablespace.". So with a typical InnoDB setup ('innondb_file_per_table' is not set) you will get the free space for all tables and not for a single table.

但是对于 InnoDB 这很重要 - “InnoDB 表报告表所属表空间的可用空间。对于位于共享表空间中的表,这是共享表空间的可用空间。”。因此,使用典型的 InnoDB 设置(未设置“innondb_file_per_table”),您将获得所有表的可用空间,而不是单个表的可用空间。

Refer: http://dev.mysql.com/doc/refman/5.5/en/tables-table.htmland http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html

参考:http: //dev.mysql.com/doc/refman/5.5/en/tables-table.htmlhttp://dev.mysql.com/doc/refman/5.5/en/show-table-status。 html

回答by DDay

According to MySQL's information on MySQL 5.6:

根据 MySQL 在MySQL 5.6上的信息:

The DATA_FREE column shows the free space in bytes for InnoDB tables

DATA_FREE 列显示 InnoDB 表的可用空间(以字节为单位)

For earlier versions like 5.5:

对于像5.5这样的早期版本:

The DATA_FREE column shows the free space in bytes for InnoDB tables.

For MySQL Cluster, DATA_FREE shows the space allocated on disk for, but not used by, a Disk Data table or fragment on disk. (In-memory data resource usage is reported by the DATA_LENGTH column.)

DATA_FREE 列显示 InnoDB 表的可用空间(以字节为单位)。

对于 MySQL 集群,DATA_FREE 显示在磁盘上为磁盘数据表或磁盘碎片分配但未使用的空间。(内存数据资源使用情况由 DATA_LENGTH 列报告。)

回答by Naveen Kumar

With innodb_file_per_table=OFF all InnoDB tables are stored in the same tablespace. DATA_FREE (the number of allocated but unused bytes) is reported for that single tablespace.

使用 innodb_file_per_table=OFF 所有 InnoDB 表都存储在同一个表空间中。为该单个表空间报告 DATA_FREE(已分配但未使用的字节数)。

Read http://dev.mysql.com/doc/refman/5.0/en/innodb-file-space.html:

阅读http://dev.mysql.com/doc/refman/5.0/en/innodb-file-space.html

"When you ask for available free space in the tablespace by issuing a SHOW TABLE STATUS statement, InnoDB reports the extents that are definitely free in the tablespace. InnoDB always reserves some extents for cleanup and other internal purposes; these reserved extents are not included in the free space."

“当您通过发出 SHOW TABLE STATUS 语句请求表空间中的可用空闲空间时,InnoDB 报告表空间中绝对空闲的范围。InnoDB 总是保留一些范围用于清理和其他内部目的;这些保留的范围不包括在自由空间。”

So, for InnoDB tables free space in tablespace is reported, and as all your tables share the same tablespace, the same value is the result.

因此,对于 InnoDB 表,表空间中的可用空间被报告,并且由于您的所有表共享相同的表空间,因此结果是相同的值。