Rechercher dans le manuel MySQL
25.30 The INFORMATION_SCHEMA TABLES Table
The TABLES table provides information
about tables in databases.
Columns in TABLES that represent
table statistics hold cached values. The
information_schema_stats_expiry
system variable defines the period of time before cached table
statistics expire. The default is 86400 seconds (24 hours). If
there are no cached statistics or statistics have expired,
statistics are retrieved from storage engines when querying table
statistics columns. To update cached values at any time for a
given table, use ANALYZE TABLE. To
always retrieve the latest statistics directly from storage
engines, set
information_schema_stats_expiry
to 0. For more information, see
Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.
If the innodb_read_only system
variable is enabled, ANALYZE
TABLE may fail because it cannot update statistics
tables in the data dictionary, which use
InnoDB. For ANALYZE
TABLE operations that update the key distribution,
failure may occur even if the operation updates the table itself
(for example, if it is a MyISAM table). To
obtain the updated distribution statistics, set
information_schema_stats_expiry=0.
The TABLES table has these columns:
TABLE_CATALOGThe name of the catalog to which the table belongs. This value is always
def.TABLE_SCHEMAThe name of the schema (database) to which the table belongs.
TABLE_NAMEThe name of the table.
TABLE_TYPEBASE TABLEfor a table,VIEWfor a view, orSYSTEM VIEWfor anINFORMATION_SCHEMAtable.The
TABLEStable does not listTEMPORARYtables.ENGINEThe storage engine for the table. See Chapter 15, The InnoDB Storage Engine, and Chapter 16, Alternative Storage Engines.
For partitioned tables,
ENGINEshows the name of the storage engine used by all partitions.VERSIONThis column is unused. With the removal of
.frmfiles in MySQL 8.0, this column now reports a hardcoded value of10, which is the last.frmfile version used in MySQL 5.7.ROW_FORMATThe row-storage format (
Fixed,Dynamic,Compressed,Redundant,Compact). ForMyISAMtables,Dynamiccorresponds to what myisamchk -dvv reports asPacked.TABLE_ROWSThe 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.TABLE_ROWSisNULLforINFORMATION_SCHEMAtables.For
InnoDBtables, the row count is only a rough estimate used in SQL optimization. (This is also true if theInnoDBtable is partitioned.)AVG_ROW_LENGTHThe average row length.
DATA_LENGTHFor
MyISAM,DATA_LENGTHis the length of the data file, in bytes.For
InnoDB,DATA_LENGTHis the approximate amount of memory allocated for the clustered index, in bytes. Specifically, it is the clustered index size, in pages, multiplied by theInnoDBpage size.Refer to the notes at the end of this section for information regarding other storage engines.
MAX_DATA_LENGTHFor
MyISAM,MAX_DATA_LENGTHis 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_LENGTHFor
MyISAM,INDEX_LENGTHis the length of the index file, in bytes.For
InnoDB,INDEX_LENGTHis 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 theInnoDBpage size.Refer to the notes at the end of this section for information regarding other storage engines.
DATA_FREEThe number of allocated but unused bytes.
InnoDBtables 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_FREEshows 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_LENGTHcolumn.)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_SCHEMAPARTITIONStable, as shown in this example:- FROM INFORMATION_SCHEMA.PARTITIONS
For more information, see Section 25.17, “The INFORMATION_SCHEMA PARTITIONS Table”.
AUTO_INCREMENTThe next
AUTO_INCREMENTvalue.CREATE_TIMEWhen the table was created.
UPDATE_TIMEWhen the data file was last updated. For some storage engines, this value is
NULL. For example,InnoDBstores multiple tables in its system tablespace and the data file timestamp does not apply. Even with file-per-table mode with eachInnoDBtable in a separate.ibdfile, 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_TIMEdisplays a timestamp value for the lastUPDATE,INSERT, orDELETEperformed onInnoDBtables that are not partitioned. For MVCC, the timestamp value reflects theCOMMITtime, which is considered the last update time. Timestamps are not persisted when the server is restarted or when the table is evicted from theInnoDBdata dictionary cache.CHECK_TIMEWhen the table was last checked. Not all storage engines update this time, in which case, the value is always
NULL.For partitioned
InnoDBtables,CHECK_TIMEis alwaysNULL.TABLE_COLLATIONThe table default collation. The output does not explicitly list the table default character set, but the collation name begins with the character set name.
CHECKSUMThe live checksum value, if any.
CREATE_OPTIONSExtra options used with
CREATE TABLE. The original options specified whenCREATE TABLEwas executed are retained. The information reported may differ from current table settings and options.For
InnoDBtables, the actualROW_FORMATandKEY_BLOCK_SIZEoptions are shown. Prior to MySQL 8.0,CREATE_OPTIONSshows the originally suppliedROW_FORMATandKEY_BLOCK_SIZE. For more information, see Section 13.1.20, “CREATE TABLE Syntax”.CREATE_OPTIONSshowspartitionedfor a partitioned table. Prior to MySQL 8.0.16, it also shows theENCRYPTIONclause specified for tables created in file-per-table tablespaces. As of MySQL 8.0.16, it only shows the encryption clause for file-per-table tablespaces if the table is encrypted or if the specified encryption differs from the schema encryption. The encryption clause is not shown for tables created in general tablespaces. To identify encrypted file-per-table and general tablespaces, query theINNODB_TABLESPACESENCRYPTIONcolumn.TABLE_COMMENTThe comment used when creating the table (or information as to why MySQL could not access the table information).
Notes
For
NDBtables, the output of this statement shows appropriate values for theAVG_ROW_LENGTHandDATA_LENGTHcolumns, with the exception thatBLOBcolumns are not taken into account.For
NDBtables,DATA_LENGTHincludes data stored in main memory only; theMAX_DATA_LENGTHandDATA_FREEcolumns apply to Disk Data.For NDB Cluster Disk Data tables,
MAX_DATA_LENGTHshows the space allocated for the disk part of a Disk Data table or fragment. (In-memory data resource usage is reported by theDATA_LENGTHcolumn.)For
MEMORYtables, theDATA_LENGTH,MAX_DATA_LENGTH, andINDEX_LENGTHvalues 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
TABLEScolumns are 0 orNULLexcept thatTABLE_NAMEindicates the view name,CREATE_TIMEindicates the creation time, andTABLE_COMMENTsaysVIEW.
Table information is also available from the
SHOW TABLE STATUS and
SHOW TABLES statements. See
Section 13.7.6.36, “SHOW TABLE STATUS Syntax”, and
Section 13.7.6.37, “SHOW TABLES Syntax”. The following statements are
equivalent:
- CREATE_OPTIONS, TABLE_COMMENT
- FROM db_name
The following statements are equivalent:
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-tables-table.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.