日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

查看mysql库大小,表大小,索引大小

發布時間:2024/4/14 数据库 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 查看mysql库大小,表大小,索引大小 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
查看所有庫的大小 mysql> use information_schema; Database changed mysql> selectconcat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data?from TABLES; +----------+ | data ? | +----------+ | 104.21MB | +----------+ 1 row in set (0.11 sec) 查看指定庫的大小 mysql> selectconcat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data?from TABLES where table_schema='jishi'; +---------+ | data ?| +---------+ | 26.17MB | +---------+ 1 row in set (0.01 sec) 查看指定庫的指定表的大小 mysql> selectconcat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data?from TABLES where table_schema='jishi' andtable_name='a_ya'; +--------+ | data ? | +--------+ | 0.02MB | +--------+ 1 row in set (0.00 sec) 查看指定庫的索引大小 mysql> SELECTCONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB') AS 'TotalIndex Size' FROM TABLES ?WHERE table_schema ='jishi';? +------------------+ | Total Index Size | +------------------+ | 0.94 MB ?| +------------------+ 1 row in set (0.01 sec) 查看指定庫的指定表的索引大小 mysql> SELECTCONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB') AS 'TotalIndex Size' FROM TABLES ?WHERE table_schema ='test' and table_name='a_yuser';? +------------------+ | Total Index Size | +------------------+ | 21.84 MB ? | +------------------+ 1 row in set (0.00 sec) mysql> show create table test.a_yuser\G; *************************** 1. row*************************** Table: a_yuser Create Table: CREATE TABLE `a_yuser` ( `email` varchar(60) NOT NULL DEFAULT'', `user_name` varchar(60) NOT NULL DEFAULT'', KEY `cc` (`email`(5)), KEY `ccb` (`user_name`(5)), KEY `ccbc`(`email`(5),`user_name`(5)) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 1 row in set (0.00 sec) ERROR:? No query specified mysql> select count(*) from test.a_yuser; +----------+ | count(*) | +----------+ | ?1073607 | +----------+ 1 row in set (0.00 sec) mysql>? 查看一個庫中的情況... mysql> ?SELECTCONCAT(table_schema,'.',table_name) AS 'Table Name',CONCAT(ROUND(table_rows/1000000,4),'M') AS 'Number of Rows',CONCAT(ROUND(data_length/(1024*1024*1024),4),'G') AS 'Data Size',CONCAT(ROUND(index_length/(1024*1024*1024),4),'G') AS 'Index Size',CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),4),'G')AS'Total'FROM information_schema.TABLES WHERE table_schema LIKE'test'; +---------------+----------------+-----------+------------+---------+ | Table Name ?| Number ofRows | Data Size | Index Size | Total ? | +---------------+----------------+-----------+------------+---------+ | test.a_br ? | 0.4625M?| 0.0259G ? | 0.0171G?| 0.0431G | | test.a_skuclr | 0.7099M ?| 0.0660G? | 0.0259G ?|0.0919G | | test.a_yuser ?| 1.0736M ?| 0.0497G? | 0.0213G ?|0.0710G | | test.test ? | 0.0000M?| 0.0000G ? | 0.0000G?| 0.0000G | +---------------+----------------+-----------+------------+---------+ 4 rows in set (0.13 sec)

?

轉載于:https://www.cnblogs.com/hllnj2008/p/5035243.html

總結

以上是生活随笔為你收集整理的查看mysql库大小,表大小,索引大小的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。