13.7.7.38 SHOW TABLE STATUS Statement

Official document address: 13.7.7.38 SHOW TABLE STATUS Statement


SHOW TABLE STATUS
    [{
   
   FROM | IN} db_name]
    [LIKE 'pattern' | WHERE expr]

SHOW TABLE STATUSSHOW TABLESWorks like the same, but provides a lot of information about each non-temporary table. You can also use the mysqlshow--status db_namecommand to get this list. If there is a LIKEclause, it indicates which table names to match. You can also use WHEREclauses to select rows using more general conditions, as discussed in 26.55 SHOW Statement Extension .

The statement also displays information about the view.

SHOW TABLE STATUSThe output has the following columns:

  • The name of the Name
    table.

  • The storage engine of the Engine table. See Chapter 15 InnoDB storage engine and storage engine Chapter 16 to choose from . For partition tables, Enginethe names of storage engines used by all partitions are displayed.
  • Version
    This column is not used. Since the .frmfile was deleted in MySQL 8.0, the value recorded in this column is now hard-coded 10, which is the last .frmfile version used in MySQL 5.7 .
  • Row_format
    row storage format ( Fixedfixed, Dynamicdynamic, Compressedcompressed, Redundantredundant, Compactcompact). For MyISAMtables, it Dynamiccorresponds to the myisamchk -dvv Packedrecorded content.
  • Rows The
    number of rows. Some storage engines, for example MyISAM, store accurate counts. For other storage engines, for example InnoDB, this value is only an approximation, the actual value may vary 40%to 50%. In this case, use SELECT COUNT(*)to get an accurate count.

    For INFORMATION_SCHEMAtables, the Rowsvalue is NULL.

    For InnoDBtables, the number of rows is only a rough estimate used in SQL optimization. (The same is true for InnoDBpartition tables.)
  • Avg_row_length
    average row length.
  • Data_length
    respect MyISAM, Data_lengthis the length of the data file, in bytes.

    For InnoDB, Data_lengthis the approximate amount of space allocated for the clustered index, in bytes. Specifically, it is the clustered index size (in pages) multiplied by the InnoDBpage size.

    For information about other storage engines, see the description at the end of this section.
  • Max_data_length
    respect MyISAM, Max_data_lengththe maximum length of the data file. This is the total number of data bytes that can be stored in the table given the size of the data pointer used.

    For InnoDB, the column is not used.

    For information about other storage engines, see the description at the end of this section.
  • Index_length
    respect MyISAM, Index_lengthis the length of the index file, in bytes.

    For InnoDB, Index_lengthis the approximate amount of space allocated for the non-clustered index, in bytes. Specifically, it is the non-clustered index size (in pages) multiplied by the InnoDBpage size.

    For information about other storage engines, see the description at the end of this section.
  • Data_free
    The number of bytes allocated but not used.

    InnoDBThe table records the free space of the table space to which the table belongs. For tables located in a shared table space, this is the free space of the shared table space. If multiple table spaces are used, and the table has its own table space, the free space only refers to the free space of the table's own table space. Free space refers to the number of bytes in a completely free section minus the safety margin. Even if the free space is shown as 0, as long as there is no need to allocate a new section, rows can be inserted.

    For NDB Cluster, Data_freedisplay the unused space allocated for disk data tables or disk fragments on the disk. (The usage of data resources in memory is Data_lengthreported by the column.)

    For partitioned tables, this value is only an estimate and may not be absolutely correct. In this case, a more accurate way to obtain this information is to query the I NFORMATION_SCHEMA PARTITIONStable, as shown in this example:
SELECT SUM(DATA_FREE)
    FROM  INFORMATION_SCHEMA.PARTITIONS
    WHERE TABLE_SCHEMA = 'mydb'
    AND   TABLE_NAME   = 'mytable';

For more information, see 26.21 INFORMATION_SCHEMA PARTITIONS table .

  • The
    next AUTO_INCREMENTvalue of Auto_increment .
  • Create_time
    The time when the table was created.
  • Update_time The
    time when the data file was last updated. For some storage engines, this value is NULL. For example, InnoDBmultiple tables are stored in its system table space, and the timestamp of the data file is not applicable. Even in the file-per-tablemode, each InnoDBtable is in a separate .ibdfile, changing the buffer will delay the write operation to the data file, so the file modification time is different from the time of the last insertion, update, or deletion. For MyISAM, the timestamp of the data file is used; however, in the Windowsabove, the timestamp will not be updated by updating, so the value is not accurate.

    Update_timeShows InnoDBthe timestamp value of the last update, insert, or delete performed on an unpartitioned table. For MVCC, the timestamp value reflects the COMMITtime, which is considered the last update time. When the server is restarted or the InnoDBtable is deleted from the data dictionary cache, the timestamp will not be persistent.
  • Check_time
    The time of the last check of the table. Not all storage engines are updated this time, in this case, the value is always NULL. For partitioned InnoDBtables, it Check_timeis always NULL.

  • The default collation of the Collation table. The output does not explicitly list the default character set of the table, but the collation name starts with the character set name.
  • Checksum
    real-time checksum value (if any).

  • CREATE TABLEExtra options used by Create_options .

    Create_optionsDisplay the partition status of the partition table.

    Before MySQL 8.0.16, the specified clauses for tables created in the tablespace were Create_optionsdisplayed . Starting from MySQL 8.0.16, if the table is encrypted, or the specified encryption is different from the mode encryption, it will display the clauses of the table space for each table file . For tables created in general tablespaces, clauses are not displayed . To identify each encrypted table file and ordinary tablespace, query the column. When creating a table with strict mode disabled, if the specified row format is not supported, the default row format of the storage engine is used. The actual row format of the table is recorded in the columns. Display the line format specified in the statement. When the storage engine of a table is changed, the table options that are not applicable to the new storage engine are retained in the table definition, so that the table and its previously defined options can be restored to the original storage engine when necessary. The reserved options can be displayed.file-per-tableENCRYPTIONENCRYPTIONENCRYPTIONINNODB_TABLESPACES ENCRYPTION

    Row_formatCreate_optionsCREATE TABLE

    Create_options
  • Comment
    The comment used when creating the table (or information about why MySQL cannot access the table information).

note

  • For InnoDBtables, SHOW TABLE STATUSno accurate statistics will be given except for the physical size reserved for the table . The number of rows is only a rough estimate used in SQL optimization.
  • For NDBtables, the output of this statement shows the appropriate values for the Avg_row_lengthsum Data_lengthcolumn, but the BLOBcolumn is not considered .
  • For the NDBtable, it Data_lengthonly contains the data in the main memory; Max_data_lengthand Data_freethe hard disk data recorded in the column.
  • For a NDB Clusterdisk data table, Max_data_lengththe space allocated for the disk portion of the disk data table or fragment is displayed. (The data resource usage in memory is Data_lengthreported by the column).
  • For MEMORYtables, the values ​​of Data_length, Max_data_lengthand are Index_lengthapproximate to the amount of memory actually allocated. The allocation algorithm reserves a large amount of memory to reduce the number of allocation operations.
  • For views, in addition to Namea view name, Create_timetime of creation, Commentdisplay VIEWoutside, SHOW TABLE STATUSit displayed most of the columns are 0or NULL.

You can also INFORMATION_SCHEMA TABLESget table information from the table. See 26.38 INFORMATION_SCHEMA TABLES table .

Guess you like

Origin blog.csdn.net/wb1046329430/article/details/115027169