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:索引大小

  • 相关阅读:
    java多线程
    java垃圾回收
    java研发常见问题总结 1
    js获取时间加多山天和时间戳转换成日期
    php时间选择器亲测可以自己修改
    html5时间选择器
    php生成员工编号,产品编号
    桌面远程链接
    SQL 左外连接查询 将右表中的多行变为左表的一列或多列
    PHPMailer发匿名邮件及Extension missing: openssl的解决
  • 原文地址:https://www.cnblogs.com/onlysun/p/4508613.html
Copyright © 2011-2022 走看看