mysql查看表大小

<p>一:命令 show table status like &#39;table_name&#39;\G;</p><pre class="brush:bash;toolbar:false">mysql&gt;showtablestatuslike&#39;x&#39;\G; ***************************1.row*************************** Name:x Engine:InnoDB Version:10 Row_format:Compact Rows:97909 Avg_row_length:37 Data_length:3686400 Max_data_length:0 Index_length:0 Data_free:4194304 Auto_increment:NULL Create_time:2015-05-1610:41:50 Update_time:NULL Check_time:NULL Collation:latin1_swedish_ci Checksum:NULL Create_options: Comment:</pre><p></p><p>其中的data_length 为数据大小;</p><p>二:命令:</p><pre class="brush:bash;toolbar:false">1&gt;useinformation_schema;2&gt;selectdata_length,index_lengthfromtableswheretable_schema=&#39;xxxx&#39;andtable_name=&#39;xxx&#39;; mysql&gt;useinformation_schema; Readingtableinformationforcompletionoftableandcolumnnames Youcanturnoffthisfeaturetogetaquickerstartupwith-A Databasechanged mysql&gt;selectdata_length,index_lengthfromtableswheretable_schema=&#39;test&#39;\ -&gt;andtable_name=&#39;x&#39;\G; ***************************1.row*************************** data_length:3686400 index_length:0 1rowinset(0.00sec)</pre><p>MB显示:</p><pre class="brush:bash;toolbar:false">mysql&gt;selectconcat(round(sum(data_length/1024/1024),2),&#39;MB&#39;)asdata_length_MB,concat(round(sum(index_length/1024/1024),2),&#39;MB&#39;)asindex_length_MB\ -&gt;fromtableswheretable_schema=&#39;test&#39;andtable_name=&#39;x&#39;\G;</pre><p>*************************** 1. row ***************************</p><p>data_length_MB: 3.52MB</p><p>index_length_MB: 0.00MB</p><p>1 row in set (0.04 sec)</p><p>TABLE_SCHEMA : 数据库名</p><p>TABLE_NAME:表名</p><p>ENGINE:所使用的存储引擎</p><p>TABLES_ROWS:记录数</p><p>DATA_LENGTH:数据大小</p><p>INDEX_LENGTH:索引大小</p>
RangeTime:0.007310s
RangeMem:205.55 KB
返回顶部 留言