数据库
首页 > 数据库> > Mysql 备查

Mysql 备查

作者:互联网


-- 数据库表占用空间大小
select
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
where table_schema='db_name';

-- 清空表(无日志)
truncate table tablename;


标签:1024,truncate,MB,sum,备查,Mysql,table,schema
来源: https://www.cnblogs.com/congxinglong/p/16407586.html