Metadatabases and data dictionaries

Updated at:

PolarDB-X uses INFORMATION_SCHEMA as its metadatabase, compatible with the MySQL metadatabase. Query it over a Java Database Connectivity (JDBC) connection using standard SQL statements.

What you can inspect

Use the following table to find the INFORMATION_SCHEMA table for each object type.

Object

INFORMATION_SCHEMA table

Databases

SCHEMATA

Tables

TABLES

Columns

COLUMNS

Indexes

STATISTICS

Global secondary indexes

GLOBAL_INDEXES

Table groups

TABLE_GROUP

Partitions

PARTITIONS, TABLE_DETAIL

Metadata locks

METADATA_LOCK

Concurrency control rules

CCL_RULE, CCL_TRIGGER

Plan caches

PLAN_CACHE

Sequences

SEQUENCES

SQL statement summaries

STATEMENTS_SUMMARY, STATEMENTS_SUMMARY_HISTORY

MySQL-compatible tables

The following INFORMATION_SCHEMA tables behave the same as in MySQL 5.7.

Table

Description

SCHEMATA

Database metadata

TABLES

Table metadata

COLUMNS

Column metadata

STATISTICS

Index metadata

ENGINES

Available storage engines

KEYWORDS

Reserved keywords

COLLATIONS

Supported collations

TABLE_CONSTRAINTS

Table constraints

PROCESSLIST

Active connections and running statements

SESSION_VARIABLES

Session-level system variables

GLOBAL_VARIABLES

Global system variables

INNODB_LOCKS

InnoDB lock information

INNODB_TRX

Active InnoDB transactions

INNODB_BUFFER_PAGE

InnoDB buffer pool page details

INNODB_BUFFER_POOL_STATS

InnoDB buffer pool statistics

INNODB_BUFFER_PAGE_LRU

InnoDB buffer pool LRU list

INNODB_LOCK_WAITS

InnoDB lock wait relationships

USER_PRIVILEGES

User privilege grants

Two tables are partially compatible:

  • COLUMN_STATISTICS: Histograms are generated based on data processed by PolarDB-X and stored in a format specific to PolarDB-X.

  • PARTITIONS: Only partitioned tables in the current PolarDB-X database have partitions.

PolarDB-X extension tables

The following tables expose distributed database concepts specific to PolarDB-X. All tables are scoped to the current PolarDB-X database.

Table

Description

WORKLOAD

Hybrid transactional and analytical processing (HTAP) workloads

GLOBAL_INDEXES

Global secondary indexes (GSIs)

METADATA_LOCK

Metadata locks (MDLs)

TABLE_GROUP

Table groups

TABLE_DETAIL

Partitions in partitioned tables

LOCALITY_INFO

Locality settings for databases and tables

PHYSICAL_PROCESSLIST

SQL statements pushed down from compute nodes to data nodes for execution

PLAN_CACHE

Execution plan caches

STATISTIC_TASK

Statistics tasks

CCL_RULE

Concurrency control (CCL) rules

CCL_TRIGGER

CCL triggers

STATEMENTS_SUMMARY

Summary of SQL statements executed in the current statistical period

STATEMENTS_SUMMARY_HISTORY

Summary of SQL statements executed in previous statistical periods

SEQUENCES

Sequences

PHYSICAL_INDEX_USAGE

Local index (LSI) usage statistics at the physical partition level

LOGICAL_INDEX_USAGE

Local index (LSI) usage statistics aggregated at the logical table level

Unsupported tables

The following tables exist in MySQL 5.7 but are not implemented in PolarDB-X.

SCHEMA_PRIVILEGES, TABLE_PRIVILEGES, INNODB_TEMP_TABLE_INFO, INNODB_SYS_INDEXES, INNODB_SYS_FIELDS, INNODB_CMP_PER_INDEX_RESET, INNODB_FT_DEFAULT_STOPWORD, INNODB_FT_INDEX_TABLE, INNODB_FT_INDEX_CACHE, INNODB_SYS_TABLESPACES, INNODB_METRICS, INNODB_SYS_FOREIGN_COLS, INNODB_CMPMEM, INNODB_SYS_COLUMNS, INNODB_SYS_FOREIGN, INNODB_SYS_TABLESTATS, INNODB_FT_CONFIG, INNODB_SYS_VIRTUAL, INNODB_CMP, INNODB_FT_BEING_DELETED, INNODB_CMP_PER_INDEX, INNODB_CMPMEM_RESET, INNODB_CMP_RESET, INNODB_FT_DELETED, INNODB_SYS_TABLES, INNODB_SYS_DATAFILES, PROFILING, REFERENTIAL_CONSTRAINTS, SESSION_STATUS, TABLESPACES, EVENTS, TRIGGERS, ROUTINES, COLUMN_PRIVILEGES, FILES, KEY_COLUMN_USAGE, OPTIMIZER_TRACE, PARAMETERS, CHARACTER_SETS, COLLATION_CHARACTER_SET_APPLICABILITY, PLUGINS

Table column reference

SCHEMATA

Stores metadata about the current database.

Column

Description

CATALOG_NAME

Catalog name. Value: def

SCHEMA_NAME

Database name

DEFAULT_CHARACTER_SET_NAME

Default character set

DEFAULT_COLLATION_NAME

Default collation

SQL_PATH

Always NULL

TABLES

Stores metadata about database tables.

Column

Description

TABLE_CATALOG

Catalog name. Value: def

TABLE_SCHEMA

Database name

TABLE_NAME

Table name

ENGINE

Storage engine

VERSION

Version number

ROW_FORMAT

Row format

TABLE_ROWS

Estimated number of rows

AVG_ROW_LENGTH

Average row length

DATA_LENGTH

Estimated size of the base table

MAX_DATA_LENGTH

Maximum table size. Default: NULL

INDEX_LENGTH

Estimated size of the index

DATA_FREE

Free storage space

AUTO_INCREMENT

Next AUTO_INCREMENT value

CREATE_TIME

Table creation time

UPDATE_TIME

Most recent update time

CHECK_TIME

Last check time. Value: NULL

TABLE_COLLATION

Default collation

CHECKSUM

Table checksum

CREATE_OPTIONS

Options from the CREATE TABLE statement

TABLE_COMMENT

Table comment

COLUMNS

Stores metadata about columns.

Column

Description

TABLE_CATALOG

Catalog name. Value: def

TABLE_SCHEMA

Database name

TABLE_NAME

Table name

COLUMN_NAME

Column name

ORDINAL_POSITION

Column position in the table

COLUMN_DEFAULT

Default value

IS_NULLABLE

Whether NULL is allowed

DATA_TYPE

Data type, without precision

CHARACTER_MAXIMUM_LENGTH

Maximum length in characters

CHARACTER_OCTET_LENGTH

Maximum length in bytes

NUMERIC_PRECISION

Precision of numeric values

NUMERIC_SCALE

Scale of numeric values

DATETIME_PRECISION

Precision of datetime values

CHARACTER_SET_NAME

Character set name

COLLATION_NAME

Collation name

COLUMN_TYPE

Column type, including precision

COLUMN_KEY

Index type on the column

EXTRA

Additional column information

PRIVILEGES

Column privileges

COLUMN_COMMENT

Column comment

GENERATION_EXPRESSION

Expression for generated columns

STATISTICS

Stores metadata about indexes.

Column

Description

TABLE_CATALOG

Catalog name of the base table. Value: def

TABLE_SCHEMA

Schema name of the base table

TABLE_NAME

Table name

NON_UNIQUE

Whether the index allows duplicate values

INDEX_SCHEMA

Schema name of the index

INDEX_NAME

Index name

SEQ_IN_INDEX

Column sequence number in the index

COLUMN_NAME

Column name

COLLATION

Column collation information

CARDINALITY

Column cardinality

SUB_PART

Index prefix length

PACKED

Compressed index information

NULLABLE

Whether the column can contain NULL

INDEX_TYPE

Index type

COMMENT

Index comment (not per-column)

INDEX_COMMENT

Index comment

PHYSICAL_INDEX_USAGE

Stores local index (LSI) usage statistics for each physical partition on each data node.

Column

Description

OBJECT_SCHEMA

Physical schema name (the actual schema name on the data node)

OBJECT_NAME

Physical table name (the actual table name on the data node)

INDEX_NAME

Index name

COUNT_STAR

Total number of index accesses (reads + writes)

LOGICAL_SCHEMA

Logical schema name

LOGICAL_TABLE

Logical table name. For a GSI table, this is the GSI table name.

COUNT_FETCH

Number of index read accesses

SUM_TIMER_WAIT

Total index wait time (unit: picoseconds)

MAX_TIMER_WAIT

Maximum single index wait time (unit: picoseconds)

LOGICAL_INDEX_USAGE

Stores local index (LSI) usage statistics aggregated across all physical partitions for each logical table.

Column

Description

LOGICAL_SCHEMA

Logical schema name

LOGICAL_TABLE

Logical table name. For a GSI table, this is the corresponding primary table name.

GSI_NAME

Global secondary index (GSI) name. Empty for non-GSI indexes.

INDEX_NAME

Index name

TOTAL_USAGE

Total number of index accesses across all partitions (reads + writes)

PARTITION_COUNT

Number of partitions

AVG_USAGE

Average usage per partition (TOTAL_USAGE / PARTITION_COUNT)

COUNT_FETCH

Total number of index read accesses across all partitions

SUM_TIMER_WAIT

Total index wait time across all partitions (unit: picoseconds)

MAX_TIMER_WAIT

Maximum single index wait time across all partitions (unit: picoseconds)

STATEMENTS_SUMMARY and STATEMENTS_SUMMARY_HISTORY

STATEMENTS_SUMMARY summarizes SQL statements executed in the current statistical period. STATEMENTS_SUMMARY_HISTORY covers the previous 24 statistical periods. Both tables group statements by SQL template.

Default settings:

  • Statistical period: 30 minutes

  • Maximum statements tracked per period: 1,000

Both tables share the same columns, organized below by diagnostic purpose.

Identification fields

Column

Description

BEGIN_TIME

Start time of the statistical period

SCHEMA

Database name

SQL_TYPE

Statement type

TEMPLATE_ID

SQL template ID

PLAN_HASH

Hash value of the execution plan

SQL_TEMPLATE

SQL template

FIRST_SEEN

First time the template was collected

LAST_SEEN

Most recent time the template was collected

SQL_SAMPLE

Sample SQL statement

PREV_TEMPLATE_ID

Template ID of the preceding SQL statement

PREV_SAMPLE_SQL

Sample of the preceding SQL statement

SAMPLE_TRACE_ID

Trace ID of the sample statement

WORKLOAD_TYPE

Workload type: TP (transactional processing) or AP (analytical processing)

EXECUTE_MODE

Execution mode: NONE, CURSOR, TP_LOCAL, AP_LOCAL, or MPP

Execution count and error fields

Column

Description

COUNT

Number of executions

ERROR_COUNT

Number of execution errors

SUM_AFFECTED_ROWS

Total rows returned or updated

AVG_AFFECTED_ROWS

Average rows returned or updated

MAX_AFFECTED_ROWS

Maximum rows returned or updated

Response time fields (unit: ms)

Column

Description

SUM_RESPONSE_TIME_MS

Total response time

AVG_RESPONSE_TIME_MS

Average response time

MAX_RESPONSE_TIME_MS

Maximum response time

Transaction time fields (unit: ms)

Transaction time is the duration from the start of the transaction to the completion of the statement.

Column

Description

SUM_TRANSACTION_TIME_MS

Total transaction time

AVG_TRANSACTION_TIME_MS

Average transaction time

MAX_TRANSACTION_TIME_MS

Maximum transaction time

Execution plan CPU time fields (unit: ms)

Column

Description

SUM_BUILD_PLAN_CPU_TIME_MS

Total CPU time to build execution plans

AVG_BUILD_PLAN_CPU_TIME_MS

Average CPU time to build an execution plan

MAX_BUILD_PLAN_CPU_TIME_MS

Maximum CPU time to build an execution plan

SUM_EXEC_PLAN_CPU_TIME_MS

Total CPU time to run execution plans

AVG_EXEC_PLAN_CPU_TIME_MS

Average CPU time to run an execution plan

MAX_EXEC_PLAN_CPU_TIME_MS

Maximum CPU time to run an execution plan

Physical pushdown fields

These fields measure the time and row counts for SQL statements pushed down from compute nodes to data nodes.

Column

Description

SUM_PHYSICAL_TIME_MS

Total pushdown time (ms)

AVG_PHYSICAL_TIME_MS

Average pushdown time (ms)

MAX_PHYSICAL_TIME_MS

Maximum pushdown time (ms)

SUM_PHYSICAL_EXEC_COUNT

Total number of physical SQL executions

AVG_PHYSICAL_EXEC_COUNT

Average number of physical SQL executions

MAX_PHYSICAL_EXEC_COUNT

Maximum number of physical SQL executions

SUM_PHYSICAL_FETCH_ROWS

Total rows retrieved by physical SQL queries

AVG_PHYSICAL_FETCH_ROWS

Average rows retrieved per physical SQL query

MAX_PHYSICAL_FETCH_ROWS

Maximum rows retrieved by a physical SQL query

What's next

For a complete reference of INFORMATION_SCHEMA tables, see the MySQL 5.7 documentation.