本文目錄一覽:
mysql怎麼查看資料庫中表的大小
1、查詢整個mysql資料庫,整個庫的大小;單位轉換為MB。
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from information_schema.TABLES
2、查詢mysql資料庫,某個庫的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data
from information_schema.TABLES
where table_schema = ‘testdb’
3、查看庫中某個表的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data
from information_schema.TABLES
where table_schema = ‘testdb’
and table_name = ‘test_a’;
4、查看mysql庫中,test開頭的表,所有存儲大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data
from information_schema.TABLES
where table_schema = ‘testdb’
and table_name like ‘test%’;
怎樣查看Mysql資料庫大小
– 1、進去指定schema 資料庫(存放了其他的資料庫的信息)
use information_schema
— 2、查詢所有數據的大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from TABLES
— 3、查看指定資料庫的大小
— 比如說 資料庫apoyl
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from TABLES where table_schema=’apoyl’;
–4、查看指定資料庫的表的大小
–比如說 資料庫apoyl 中apoyl_test表
select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from TABLES where table_schema=’apoyl’ and table_name=’apoyl_test’;
如何用SQL命令查看Mysql資料庫大小
1、進入information_schema 資料庫(存放了其他的資料庫的信息)
use information_schema;
2、查詢所有數據的大小:
select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables;
3、查看指定資料庫的大小:
比如查看資料庫home的大小
select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables where table_schema=’home’;
4、查看指定資料庫的某個表的大小
比如查看資料庫home中 members 表的大小
select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables where table_schema=’home’ and table_name=’members’;
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/303772.html