mysql :

1.查询某个数据库的大小
select concat(round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024/1024,2),'G') from information_schema.tables 
where table_schema='数据库名';

 

2.查询某个表的大小
select concat(round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024/1024,2),'G') from information_schema.tables 
where table_schema='数据库名' and table_name=’表名’