zoukankan      html  css  js  c++  java
  • mysql查看表大小

    mysql查看表大小

    一:命令 show table status like 'table_name'G;

    mysql> show table status like 'x'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-16 10:41:50
        Update_time: NULL
         Check_time: NULL
          Collation: latin1_swedish_ci
           Checksum: NULL
     Create_options: 
            Comment: 

     其中的data_length 为数据大小;

    二:命令:1> use information_schema; 2>select data_length,index_length  from tables where  table_schema='xxxx'  and table_name = 'xxx';

    mysql> use information_schema;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> select data_length,index_length from tables where table_schema ='test' 
        -> and table_name = 'x'G;
    *************************** 1. row ***************************
     data_length: 3686400
    index_length: 0
    1 row in set (0.00 sec)

     MB显示:

      

    mysql> select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB,concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB 
        -> from tables where table_schema = 'test' and table_name ='x'G;
    *************************** 1. row ***************************
     data_length_MB: 3.52MB
    index_length_MB: 0.00MB
    1 row in set (0.04 sec)

    TABLE_SCHEMA : 数据库名
    TABLE_NAME:表名
    ENGINE:所使用的存储引擎
    TABLES_ROWS:记录数
    DATA_LENGTH:数据大小
    INDEX_LENGTH:索引大小

  • 相关阅读:
    strcpy ,strncpy ,strlcpy(转载)
    窗口刷新时的问题(转)
    Linux下的实时流媒体编程(RTP,RTCP,RTSP)
    YUV色彩空间(转自百度百科)
    VC++2005快速构建安全的应用程序
    Linux多线程编程
    C++ PASCAL关键字(转)
    SkinMagic 进行皮肤设置
    .h和.cpp文件的区别
    strcpy_s与strcpy安全性的比较(转载)
  • 原文地址:https://www.cnblogs.com/onlysun/p/4508613.html
Copyright © 2011-2022 走看看