惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
L
LangChain Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
D
Docker
B
Blog
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
G
Google Developers Blog
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42

裴先生笔记

[通胀十年]“消费驱动、自由化”转向“安全驱动、再工业化“ - 裴先生笔记 Jenkins + Docker 全流程实战(前后端构建 & 常见问题) 轻量级多节点系统监控方案实战:Node Exporter + Prometheus + Grafana & 替代方案 如何查询 Hive表 stored as 类型 [通胀十年]超级债务危机 - 裴先生笔记
查看 MYSQL 库大小、表大小、索引大小 - 裴先生笔记
2025-01-16 · via 裴先生笔记

共计 1050 个字符,预计需要花费 3 分钟才能阅读完成。

SELECT temp.`Table Name`                  AS tableName,
       CONCAT(temp.`Number of Rows`, 'M') AS NumberofRows,
       CONCAT(temp.`Data Size`, 'G')      AS DataSize,
       CONCAT(temp.`Index Size`, 'G')     AS IndexSize,
       CONCAT(temp.Total, 'G')            AS Total
FROM (SELECT CONCAT(table_schema, '.', table_name)                         AS 'Table Name',
             ROUND(table_rows / 1000000, 4)                                AS 'Number of Rows',
             ROUND(data_length / (1024 * 1024 * 1024), 4)                  AS 'Data Size',
             ROUND(index_length / (1024 * 1024 * 1024), 4)                 AS 'Index Size',
             ROUND((data_length + index_length) / (1024 * 1024 * 1024), 4) AS 'Total'
      FROM information_schema.TABLES
      WHERE table_schema LIKE 'YOUR_DATABASE_NAME') temp
ORDER BY temp.Total DESC

查询结果如下:

tableName NumberofRows DataSize IndexSize Total
umami_2.website_event 0.0406M 0.0142G 0.0662G 0.0805G
umami_2.session 0.0185M 0.0034G 0.0368G 0.0403G
umami_2.team_user 0.0000M 0.0000G 0.0000G 0.0001G
umami_2.team 0.0000M 0.0000G 0.0000G 0.0001G
umami_2.session_data 0.0000M 0.0000G 0.0000G 0.0001G
umami_2.report 0.0000M 0.0000G 0.0001G 0.0001G
umami_2.event_data 0.0000M 0.0000G 0.0001G 0.0001G
umami_2.website 0.0000M 0.0000G 0.0001G 0.0001G
umami_2._prisma_migrations 0.0000M 0.0000G 0.0000G 0.0000G
umami_2.user 0.0000M 0.0000G 0.0000G 0.0000G