抑郁症健康,内容丰富有趣,生活中的好帮手!
抑郁症健康 > 查询mysql存储数据大小_MySQL如何查询数据占用存储空间的大小?

查询mysql存储数据大小_MySQL如何查询数据占用存储空间的大小?

时间:2021-06-23 14:07:01

相关推荐

最简单的方式,直接查看全局的,如下所示:

mysql> use information_schema;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select concat(round(sum(DATA_LENGTH/1024/1024),2), 'MB') as data from TABLES;

+-----------+

| data |

+-----------+

| 5516.40MB |

+-----------+

1 row in set (0.16 sec)

mysql>如果只想查看Zabbix数据库

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

| zabbix |

+--------------------+

4 rows in set (0.00 sec)

mysql> select sum(DATA_LENGTH)+sum(INDEX_LENGTH) from information_schema.tables where table_schema='zabbix';

+------------------------------------+

| sum(DATA_LENGTH)+sum(INDEX_LENGTH) |

+------------------------------------+

| 9501360128 |

+------------------------------------+

1 row in set (0.09 sec)

mysql> select concat(round(sum(DATA_LENGTH)/1024/1024+sum(INDEX_LENGTH)/1024/1024),'M') from information_schema.tables where table_schema='zabbix';

+---------------------------------------------------------------------------+

| concat(round(sum(DATA_LENGTH)/1024/1024+sum(INDEX_LENGTH)/1024/1024),'M') |

+---------------------------------------------------------------------------+

| 9063M |

+---------------------------------------------------------------------------+

1 row in set (0.10 sec)

mysq>

如果觉得《查询mysql存储数据大小_MySQL如何查询数据占用存储空间的大小?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。