INNODB_CMP_PER_INDEX 和 INNODB_CMP_PER_INDEX_RESET 表提供了与 压缩 InnoDB 表和索引相关操作的状态信息,为每个数据库、表和索引组合提供单独的统计信息,以帮助您评估压缩对特定表的性能和实用性。The INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET tables
provide status information on operations related to
compressed
InnoDB tables and indexes, with separate
statistics for each combination of database, table, and index, to
help you evaluate the performance and usefulness of compression
for specific tables.
对于压缩的InnoDB表,表数据和所有的二级索引都被压缩。在这种情况下,表数据被视为另一个索引,它恰好包含所有列:即聚簇索引。For a compressed InnoDB table, both the table
data and all the secondary
indexes are compressed. In this context, the table data is
treated as just another index, one that happens to contain all the
columns: the clustered
index.
INNODB_CMP_PER_INDEX和INNODB_CMP_PER_INDEX_RESET表具有以下列:The INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET tables
have these columns:
DATABASE_NAME包含相关表的架构(数据库)。The schema (database) containing the applicable table.
TABLE_NAMETABLE_NAME要监控压缩统计信息的表。The table to monitor for compression statistics.
INDEX_NAME要监控压缩统计信息的索引。The index to monitor for compression statistics.
COMPRESS_OPS尝试的压缩操作次数。页面在创建空页面或未压缩修改日志的空间耗尽时会被压缩。The number of compression operations attempted. Pages are compressed whenever an empty page is created or the space for the uncompressed modification log runs out.
COMPRESS_OPS_OK成功的压缩操作次数。从
COMPRESS_OPS值中减去即可得到压缩失败的次数。除以COMPRESS_OPS值即可得到压缩失败的百分比。The number of successful compression operations. Subtract from theCOMPRESS_OPSvalue to get the number of compression failures. Divide by theCOMPRESS_OPSvalue to get the percentage of compression failures.COMPRESS_TIME用于压缩此索引中数据的总时间(秒)。The total time in seconds used for compressing data in this index.
UNCOMPRESS_OPS执行的解压操作次数。每当压缩
InnoDB页面 失败,或者第一次在 缓冲池 中访问压缩页面且未存在未压缩页面时,都会对压缩页面进行解压。The number of uncompression operations performed. CompressedInnoDBpages are uncompressed whenever compression fails, or the first time a compressed page is accessed in the buffer pool and the uncompressed page does not exist.UNCOMPRESS_TIME用于解压此索引中数据的总时间(以秒为单位)。The total time in seconds used for uncompressing data in this index.
示例Example
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX\G
*************************** 1. row ***************************
database_name: employees
table_name: salaries
index_name: PRIMARY
compress_ops: 0
compress_ops_ok: 0
compress_time: 0
uncompress_ops: 23451
uncompress_time: 4
*************************** 2. row ***************************
database_name: employees
table_name: salaries
index_name: emp_no
compress_ops: 0
compress_ops_ok: 0
compress_time: 0
uncompress_ops: 1597
uncompress_time: 0
说明Notes
使用这些表来衡量
InnoDB表 压缩 对特定表、索引或两者的效果。Use these tables to measure the effectiveness ofInnoDBtable compression for specific tables, indexes, or both.您必须具有
PROCESS权限才能查询这些表。You must have thePROCESSprivilege to query these tables.使用
INFORMATION_SCHEMA的COLUMNS表或SHOW COLUMNS语句查看这些表列的其他信息,包括数据类型和默认值。Use theINFORMATION_SCHEMACOLUMNStable or theSHOW COLUMNSstatement to view additional information about the columns of these tables, including data types and default values.由于为每个索引收集单独的测量会带来显著的性能开销,
INNODB_CMP_PER_INDEX和INNODB_CMP_PER_INDEX_RESET统计信息默认情况下不会被收集。你必须在对希望监控的压缩表执行操作之前启用innodb_cmp_per_index_enabled系统变量。Because collecting separate measurements for every index imposes substantial performance overhead,INNODB_CMP_PER_INDEXandINNODB_CMP_PER_INDEX_RESETstatistics are not gathered by default. You must enable theinnodb_cmp_per_index_enabledsystem variable before performing the operations on compressed tables that you want to monitor.有关使用信息,请参见第 17.9.1.4 节,“运行时监控 InnoDB 表压缩”和第 17.15.1.3 节,“使用压缩信息模式表”。有关
InnoDB表压缩的一般信息,请参见第 17.9 节,“InnoDB 表和页面压缩”。For usage information, see Section 17.9.1.4, “Monitoring InnoDB Table Compression at Runtime” and Section 17.15.1.3, “Using the Compression Information Schema Tables”. For general information aboutInnoDBtable compression, see Section 17.9, “InnoDB Table and Page Compression”.