SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',
CONCAT(ROUND(table_rows/1000000,4),'M') AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024),4),'MB') AS 'Data Size',
CONCAT(ROUND(index_length/(1024*1024),4),'MB') AS 'Index Size',
CONCAT(ROUND((data_length+index_length)/(1024*1024),4),'MB') AS'Total'
FROM information_schema.TABLES WHERE table_schema LIKE 'dbname';
CONCAT(ROUND(table_rows/1000000,4),'M') AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024),4),'MB') AS 'Data Size',
CONCAT(ROUND(index_length/(1024*1024),4),'MB') AS 'Index Size',
CONCAT(ROUND((data_length+index_length)/(1024*1024),4),'MB') AS'Total'
FROM information_schema.TABLES WHERE table_schema LIKE 'dbname';
本文介绍了一个SQL查询语句,用于从指定的数据库(dbname)中获取所有表的相关信息,包括表名、行数(百万为单位)、数据大小、索引大小及总大小等。
8347

被折叠的 条评论
为什么被折叠?



