罪恶克星 发表于 2022-8-9 14:43:36

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;
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: Mysql 备查