/*查詢mysql資料庫裡面的所有資料庫各自占用大小*/
select table_schema, concat(truncate(sum(data_length)/1024/1024,2),' mb') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size
from information_schema.tables
group by table_schema
order by data_length desc;
/*查詢mysql資料庫裡面的單個資料庫占用大小*/
select concat(truncate(sum(data_length)/1024/1024,2),'mb') as data_size,
concat(truncate(sum(max_data_length)/1024/1024,2),'mb') as max_data_size,
concat(truncate(sum(data_free)/1024/1024,2),'mb') as data_free,
concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size
from information_schema.tables where table_schema = '資料庫名';
/*查詢mysql資料庫裡面的單個資料庫所有表各自占用大小*/
select table_name, concat(truncate(data_length/1024/1024,2),' mb') as data_size,
concat(truncate(index_length/1024/1024,2),' mb') as index_size
from information_schema.tables where table_schema = '資料庫名'
group by table_name
order by data_length desc;
/*查詢mysql資料庫裡面的單個資料庫指定表占用大小*/
select concat(truncate(sum(data_length)/1024/1024,2),'mb') as data_size,
concat(truncate(sum(max_data_length)/1024/1024,2),'mb') as max_data_size,
concat(truncate(sum(data_free)/1024/1024,2),'mb') as data_free,
concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size
from information_schema.tables where table_name = '表名';
檢視mysql資料庫所佔空間大小
select concat round sum data length 1024 1024 sum index length 1024 1024 m from information schema.tables where table schema database name 由於資料太大了。所以m...
MySQL 檢視資料庫所佔空間大小
在mysql中會有乙個預設的資料庫 information schema,裡面有乙個tables表記錄了所有表的資訊。使用該錶來看資料庫所佔空間大小的 如下 use information schema select table schema,sum data length from tables ...
達夢資料庫查詢表資料占用大小
今天在做乙個日誌警告的功能,需要查詢出日誌表的大小,然後根據所填的日誌閾值去對比,之後就是其他的操作.sql如下 select table used space 模式 表名 page 1024 1024.0 from dual m為單位因為達夢是以oracle封裝的,所以oracle的查詢方式也是適...