mysql sql语句笔记整理

Posted on 2019-10-10 12:23  tobyhuzhang  阅读(121)  评论(0)    收藏  举报
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';

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3