如何获取以GB为单位的mysql表大小 [英] how to get mysql table size in GB
问题描述
最后通过以下查询计算出MySQL表的大小(以GB为单位).
Just ended up with calculating the size of MySQL table in GB with the following query.
选择(data_length + index_length)/power(1024,3)tablesize_gb FROM information_schema.tables,其中table_schema ='db'和 table_name ='tablename'
SELECT (data_length+index_length)/power(1024,3) tablesize_gb FROM information_schema.tables WHERE table_schema='db' and table_name='tablename'
是否可以获得以GB为单位的MySQL行的大小.
Is it possible to get the size of a MySQL row in GB.
或者如何获取表的平均行大小(以GB为单位).
Or how to get the avg row size for the table in GB.
推荐答案
To get the average row length (including overhead), use the AVG_ROW_LENGTH
column in information_schema.tables.
据我所知,无法计算MySQL中单个特定行的确切实际大小.
As far as I'm aware, there's no way to calculate the exact actual size of a single, specific row in MySQL.
这篇关于如何获取以GB为单位的mysql表大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!