Rechercher dans le manuel MySQL
13.7.6.36 SHOW TABLE STATUS Syntax
SHOW TABLE STATUS
works likes
SHOW TABLES
, but provides a lot
of information about each non-TEMPORARY
table. You can also get this list using the mysqlshow
--status db_name
command.
The LIKE
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
Section 25.41, “Extensions to SHOW Statements”.
This statement also displays information about views.
SHOW TABLE STATUS
output has
these columns:
Name
The name of the table.
Engine
The storage engine for the table. See Chapter 15, The InnoDB Storage Engine, and Chapter 16, Alternative Storage Engines.
For partitioned tables,
Engine
shows the name of the storage engine used by all partitions.Version
This column is unused. With the removal of
.frm
files in MySQL 8.0, this column now reports a hardcoded value of10
, which is the last.frm
file version used in MySQL 5.7.Row_format
The row-storage format (
Fixed
,Dynamic
,Compressed
,Redundant
,Compact
). ForMyISAM
tables,Dynamic
corresponds to what myisamchk -dvv reports asPacked
.Rows
The number of rows. Some storage engines, such as
MyISAM
, store the exact count. For other storage engines, such asInnoDB
, this value is an approximation, and may vary from the actual value by as much as 40% to 50%. In such cases, useSELECT COUNT(*)
to obtain an accurate count.The
Rows
value isNULL
forINFORMATION_SCHEMA
tables.For
InnoDB
tables, the row count is only a rough estimate used in SQL optimization. (This is also true if theInnoDB
table is partitioned.)Avg_row_length
The average row length.
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 theInnoDB
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 theInnoDB
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.
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 NDB Cluster,
Data_free
shows the space allocated on disk for, but not used by, a Disk Data table or fragment on disk. (In-memory data resource usage is reported by theData_length
column.)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:- FROM INFORMATION_SCHEMA.PARTITIONS
For more information, see Section 25.16, “The INFORMATION_SCHEMA PARTITIONS Table”.
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 system tablespace and the data file timestamp does not apply. Even with file-per-table mode with eachInnoDB
table in a separate.ibd
file, change buffering 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. ForMyISAM
, the data file timestamp is used; however, on Windows the timestamp is not updated by updates, so the value is inaccurate.Update_time
displays a timestamp value for the lastUPDATE
,INSERT
, orDELETE
performed onInnoDB
tables that are not partitioned. For MVCC, the timestamp value reflects theCOMMIT
time, which is considered the last update time. Timestamps are not persisted when the server is restarted or when the table is evicted from theInnoDB
data dictionary cache.Check_time
When the table was last checked. Not all storage engines update this time, in which case, the value is always
NULL
.For partitioned
InnoDB
tables,Check_time
is alwaysNULL
.Collation
The table default collation. The output does not explicitly list the table default character set, but the collation name begins with the character set name.
Checksum
The live checksum value, if any.
Create_options
Extra options used with
CREATE TABLE
. The original options from whenCREATE TABLE
was executed are retained and the options reported here may differ from the active table settings and options.For
InnoDB
tables, the actualROW_FORMAT
andKEY_BLOCK_SIZE
options are reported. Prior to MySQL 8.0,Create_options
reports the originally suppliedROW_FORMAT
andKEY_BLOCK_SIZE
. For more information, see Section 13.1.20, “CREATE TABLE Syntax”.Create_options
showspartitioned
if the table is partitioned. It also shows theENCRYPTION
option specified when creating or altering a file-per-table tablespace. This column does not show the encryption option specified when creating or altering a general tablespace. TheENCRYPTION
column of theINNODB_TABLESPACES
table is applicable to both file-per-table and general tablespaces.Comment
The comment used when creating the table (or information as to why MySQL could not access the table information).
Notes
For
NDB
tables, the output of this statement shows appropriate values for theAvg_row_length
andData_length
columns, with the exception thatBLOB
columns are not taken into account.For
NDB
tables,Data_length
includes data stored in main memory only; theMax_data_length
andData_free
columns apply to Disk Data.For NDB Cluster Disk Data tables,
Max_data_length
shows the space allocated for the disk part of a Disk Data table or fragment. (In-memory data resource usage is reported by theData_length
column.)For
MEMORY
tables, theData_length
,Max_data_length
, andIndex_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 views, most columns displayed by
SHOW TABLE STATUS
are 0 orNULL
except thatName
indicates the view name,Create_time
indicates the creation time, andComment
saysVIEW
.
Table information is also available from the
INFORMATION_SCHEMA
TABLES
table. See
Section 25.29, “The INFORMATION_SCHEMA TABLES Table”.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-show-table-status.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.