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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
Spread Privacy
Spread Privacy
I
InfoQ
V
V2EX
S
Schneier on Security
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
S
SegmentFault 最新的问题
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Latest news
Latest news
S
Secure Thoughts
Project Zero
Project Zero
MongoDB | Blog
MongoDB | Blog
I
Intezer
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
N
Netflix TechBlog - Medium
V2EX - 技术
V2EX - 技术
量子位
T
Threatpost
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
T
Tor Project blog
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
博客园 - Franky
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
L
LINUX DO - 热门话题

裴先生笔记

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