- MySQL 5.6
SHOW TABLE STATUS
用法
SHOW TABLE STATUS [{FROM | IN}db_name
] [LIKE 'pattern
' | WHEREexpr
]
SHOW
TABLE STATUS
的工作機制像 SHOW
TABLES
, 但是對於非
TEMPORARY
table提供了更多的信息. 你也可以使用下面的命令來得到想要的內容: mysqlshow
--status db_name
.LIKE
這個關鍵字可以匹配你要想指定那個表,
if present, indicates which table names to match. The WHERE
clause
can be given to select rows using more general conditions, as discussed inSection 20.32,
“Extensions to SHOW
Statements”.
This statement also displays information about views.
SHOW
TABLE STATUS
會有下面這些列:
-
Name
The name of the table.
表名
-
Engine
The storage engine for the table. See Chapter 14, Storage Engines.
表的存儲引擎
-
Version
The version number of the table's
.frm
file..frm 文件的version版本號
-
Row_format
The row-storage format (
Fixed
,Dynamic
,Compressed
,Redundant
,Compact
). ForMyISAM
tables, (Dynamic
corresponds to what myisamchk -dvv reports asPacked
. The format ofInnoDB
tables is reported asRedundant
orCompact
. For theBarracuda
file format of theInnoDB Plugin
, the format may beCompressed
orDynamic
.row-storage 格式有這樣.(
Fixed
,Dynamic
,Compressed
,Redundant
,Compact)
對於MyISAM這樣的表(Dynamic 對應着((what myisamchk -dvv reports as
Packed
.Innodb)) 的表是Redundant
或者 Compact。對於InnoDB PluginBarracuda 文件的,一般爲
Compressed
或者Dynamic
. -
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.行數。一些存儲引擎,例如MyISAM,會存儲額外的個數。對於其他的存儲引擎,例如InnoDB,這個值會是估算只,對於實際的數字會有40%-50%的範圍估算。在這樣的case中,通常使用SELECT COUNT(*)來增加準確度。
The
Rows
value isNULL
for tables in theINFORMATION_SCHEMA
database.在
INFORMATION_SCHEMA
這樣的數據庫中,Rows 都爲 NULL -
Avg_row_length
行長度
-
Data_length
數據文件長度
-
Max_data_length
數據文件最大值. 這個是是用bytes來統計表中數據的
-
Index_length
索引長度
-
Data_free
The number of allocated but unused bytes.
分配的數值,而不針對unused
This information is also shown for
InnoDB
tables (previously, it was in theComment
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 completely free 1MB 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:SELECT SUM(DATA_FREE) FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA = 'mydb' AND TABLE_NAME = 'mytable';
For more information, see Section 20.14, “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. -
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
CREATE TABLE
. The original options supplied whenCREATE TABLE
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).
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 NDB
tables,
the output of this statement shows appropriate values for the Avg_row_length
andData_length
columns,
with the exception that BLOB
columns
are not taken into account
For views, all the fields displayed by SHOW
TABLE STATUS
are NULL
except
that Name
indicates the
view name and Comment
says view
.