博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL之SHOW TABLE STATUS命令
阅读量:5737 次
发布时间:2019-06-18

本文共 6989 字,大约阅读时间需要 23 分钟。

MySQL之SHOW TABLE STATUS命令


官网:

13.7.5.37 SHOW TABLE STATUS Syntax

 
Press CTRL+C to copy
SHOW
TABLE
STATUS
[{
FROM
|
IN}
db_name
]
[
LIKE
'pattern'
|
WHERE
expr
]

works likes , but provides a lot of information about each non-TEMPORARY table. You can also get this list using the command. The clause, if present, indicates which table names to match. The WHERE clause can be given to select rows using more general conditions, as discussed in .

This statement also displays information about views.

output has the following columns:

  • Name

    The name of the table.

  • Engine

    The storage engine for the table. See .

  • Version

    The version number of the table's .frm file.

  • Row_format

    The row-storage format (Fixed, Dynamic, Compressed, Redundant, Compact). For MyISAM tables, Dynamic corresponds to what reports as Packed. InnoDB table format is either Redundant or Compact when using the Antelope file format, or Compressed or Dynamic when using the Barracuda file format.

  • Rows

    The number of rows. Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count.

    The Rows value is NULL for tables in the INFORMATION_SCHEMA database.

  • Avg_row_length

    The average row length.

    Refer to the notes at the end of this section for related information.

  • Data_length

    For MyISAM, Data_length is the length of the data file, in bytes.

    For InnoDB, Data_length is the approximate amount of memory allocated for the clustered index, in bytes. Specifically, it is the clustered index size, in pages, multiplied by the InnoDB page size.

    Refer to the notes at the end of this section for information regarding other storage engines.

  • Max_data_length

    For MyISAM, Max_data_length is maximum length of the data file. This is the total number of bytes of data that can be stored in the table, given the data pointer size used.

    Unused for InnoDB.

    Refer to the notes at the end of this section for information regarding other storage engines.

  • Index_length

    For MyISAM, Index_length is the length of the index file, in bytes.

    For InnoDB, Index_length is the approximate amount of memory allocated for non-clustered indexes, in bytes. Specifically, it is the sum of non-clustered index sizes, in pages, multiplied by the InnoDB page size.

    Refer to the notes at the end of this section for information regarding other storage engines.

  • Data_free

    The number of allocated but unused bytes.

    This information is also shown for InnoDB tables (previously, it was in the Comment value). InnoDB tables report the free space of the tablespace to which the table belongs. For a table located in the shared tablespace, this is the free space of the shared tablespace. If you are using multiple tablespaces and the table has its own tablespace, the free space is for only that table. Free space means the number of bytes in completely free extents minus a safety margin. Even if free space displays as 0, it may be possible to insert rows as long as new extents need not be allocated.

    For partitioned tables, this value is only an estimate and may not be absolutely correct. A more accurate method of obtaining this information in such cases is to query the INFORMATION_SCHEMA.PARTITIONS table, as shown in this example:

     
    Press CTRL+C to copy
    SELECT
    SUM
    (DATA_FREE
    )
    FROM INFORMATION_SCHEMA
    .
    PARTITIONS
    WHERE TABLE_SCHEMA
    =
    'mydb'
    AND
    TABLE_NAME
    =
    'mytable'
    ;

    For more information, see .

  • Auto_increment

    The next AUTO_INCREMENT value.

  • Create_time

    When the table was created.

  • Update_time

    When the data file was last updated. For some storage engines, this value is NULL. For example, InnoDB stores multiple tables in its and the data file timestamp does not apply. Even with mode with each InnoDB table in a separate .ibd file, can delay the write to the data file, so the file modification time is different from the time of the last insert, update, or delete. For MyISAM, the data file timestamp is used; however, on Windows the timestamp is not updated by updates so the value is inaccurate.

  • Check_time

    When the table was last checked. Not all storage engines update this time, in which case the value is always NULL.

  • Collation

    The table's character set and collation.

  • Checksum

    The live checksum value (if any).

  • Create_options

    Extra options used with . The original options supplied when is called are retained and the options reported here may differ from the active table settings and options.

  • Comment

    The comment used when creating the table (or information as to why MySQL could not access the table information).

Notes:

  • For MEMORY tables, the Data_length, Max_data_length, and Index_length values approximate the actual amount of allocated memory. The allocation algorithm reserves memory in large amounts to reduce the number of allocation operations.

  • For tables, the output of this statement shows appropriate values for the Avg_row_length and Data_length columns, with the exception that columns are not taken into account

  • For views, all the fields displayed by are NULL except that Name indicates the view name and Comment says view. 



[FROM db_name]  可选,表示查询哪个数据库下面的表信息。

[LIKE 'pattern'] 可选,表示查询哪些具体的表名。

2、例如

(1)、show table status from db_name 

查询db_name 数据库里所有表的信息

(2)、show table status from db_name like 'esf_seller_history'\G;

查询db_name 里 esf_seller_history 表的信息

(3)、show table status from db_name LIKE 'uc%'

查询db_name 数据库里表名以uc开头的表的信息

show table status 获取表的信息

show table status like 'tableName' \G

1.Name  

       表名称

2.Engine:

       表的存储引擎

3.Version:

       版本

4.Row_format

       行格式。对于MyISAM引擎,这可能是Dynamic,Fixed或Compressed。动态行的行长度可变,例如Varchar或Blob类型字段。固定行是指行长度不变,例如Char和Integer类型字段。

5. Rows

       表中的行数。对于非事务性表,这个值是精确的,对于事务性引擎,这个值通常是估算的。

6.Avg_row_length

       平均每行包括的字节数 

7.Data_length

       整个表的数据量(单位:字节)

8.Max_data_length

      表可以容纳的最大数据量

9.Index_length

      索引占用磁盘的空间大小 

10.Data_free

     对于MyISAM引擎,标识已分配,但现在未使用的空间,并且包含了已被删除行的空间。

11.Auto_increment

     下一个Auto_increment的值

12.Create_time

     表的创建时间

13.Update_time

     表的最近更新时间

14.Check_time

     使用 check table 或myisamchk工具检查表的最近时间

15.Collation

     表的默认字符集和字符排序规则

16.Checksum

如果启用,则对整个表的内容计算时的校验和

17.Create_options

指表创建时的其他所有选项

18.Comment

包含了其他额外信息,对于MyISAM引擎,包含了注释徐标新,如果表使用的是innodb引擎 ,将现实表的剩余空间。如果是一个视图,注释里面包含了VIEW字样。

SHOW TABLE STATUS会返回以下字段:

Name

表的名称

Engine

表的存储引擎。在MySQL 4.1.2之前,本值被标记为Type。

Version

表的.frm文件的版本号

Row_format

行存储格式(Fixed, Dynamic, Compressed, Redundant, Compact)。InnoDB表的格式被报告为Redundant或Compact

Rows

行的数目。部分存储引擎,如MyISAM,存储精确的数目。对于其它存储引擎,比如InnoDB,本值是一个大约的数,与实际值相差可达40到50%。在这些情况下,使用SELECT COUNT(*)来获得准确的数目。对于在INFORMATION_SCHEMA数据库中的表,Rows值为NULL。

Avg_row_length

平均的行长度。

 

Data_length

数据文件的长度。

Max_data_length

数据文件的最大长度。如果给定了数据指针的大小,这是可以被存储在表中的数据的字节总数。

 

Index_length

索引文件的长度。

Data_free

被整序,但是未使用的字节的数目。

Auto_increment

下一个AUTO_INCREMENT值。

Create_time

表创建时间。

Update_time

什么时候数据文件被最后一次更新

Check_time

什么时候表被最后一次检查。不是所有的存储引擎此时都更新,在此情况下,值为NULL。

Collation

表的字符集和整序。

Checksum

活性校验和值。

Create_options

和CREATE TABLE同时使用的额外选项。

Comment

创建表时使用的评注(或者有关为什么MySQL可以访问表信息的说明)。



     


 



 

           

转载地址:http://vtwzx.baihongyu.com/

你可能感兴趣的文章
SQL结构化查询语言
查看>>
ES6:模块简单解释
查看>>
JavaScript indexOf() 方法
查看>>
Java 8 新特性:2-消费者(Consumer)接口
查看>>
用Bootstrap写一份简历
查看>>
ZJU PAT 1023
查看>>
20141031老板讲话总结
查看>>
WMI远程访问问题解决方法
查看>>
从零开始学习IOS,(UILabel控件)详细使用和特殊效果
查看>>
Android开发历程_15(AppWidget的使用)
查看>>
阿花宝宝 Java 笔记 之 初识java
查看>>
7、设计模式-创建型模式-建造者模式
查看>>
Cesium官方教程11--建模人员必读
查看>>
我国古代的勾股定理
查看>>
Linux下的C编程实战
查看>>
[32期] html中部分代码与英语单词关系
查看>>
PHP安装环境,服务器不支持curl_exec的解决办法
查看>>
Count and Say
查看>>
9.1(java学习笔记)正则表达式
查看>>
fopen打开文件失败的问题
查看>>