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

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

裴先生笔记

[通胀十年]“消费驱动、自由化”转向“安全驱动、再工业化“ - 裴先生笔记 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