Skip to content

Instantly share code, notes, and snippets.

@rambolee
Created October 25, 2016 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rambolee/1c6ce3dc53e13d7364ac4efa7a7fd2a3 to your computer and use it in GitHub Desktop.
Save rambolee/1c6ce3dc53e13d7364ac4efa7a7fd2a3 to your computer and use it in GitHub Desktop.
统计 MySQL 表大小
SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',
CONCAT(ROUND(table_rows/1000000,2),'M') AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024),2),'M') AS 'Data Size' ,
CONCAT(ROUND(index_length/(1024*1024),2),'M') AS 'Index Size' ,
CONCAT(ROUND((data_length+index_length)/(1024*1024),2),'M') AS 'Total'
FROM information_schema.TABLES
WHERE table_schema='ump' order by Total desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment