mysql sql语句笔记整理

use information_schema;
-- 查看当前数据库大小
select concat(round(sum(data_length)/(1024*1024),2) + round(sum(index_length)/(1024*1024),2),'MB') as 'DB Size' from tables where table_schema='tspdata';
-- 查看数据所占的空间大小
select concat(round(sum(data_length)/(1024*1024),2),'MB') as 'DB Size' from tables where table_schema='tspdata';
-- 查看索引所占的空间大小
select concat(round(sum(index_length)/(1024*1024),2),'MB') as 'DB Size'  from tables where table_schema='tspdata';

猜你喜欢

转载自www.cnblogs.com/tobyzhang/p/11647204.html