# System Tables


After initialization, an instance contains several **system databases** that store metadata, compatibility-layer information, and internal runtime data. System objects are **read-only by default**. Do not write business logic that modifies undocumented internal table structures.

## System databases

| Database | Product-oriented purpose |
| --- | --- |
| `mo_catalog` | MatrixOne metadata, including databases, tables, columns, indexes, users, roles, and grant relationships |
| `information_schema` | Information-schema views compatible with common table-structure and privilege inspection workflows |
| `mysql` | A subset of system tables for the MySQL compatibility layer |
| `system` | Runtime and log system data |
| `system_metrics` | System metrics data |

> Some older documents use a spelling variant for the metrics database. Refer to the actual database name returned by `SHOW DATABASES`; the common name is `system_metrics`.

## Common `mo_catalog` tables

You do not need to memorize every column. Query the tables required for the task:

| Table | What it contains |
| --- | --- |
| `mo_database` | Database list, creation information, subscription status, and more |
| Table and column metadata tables | Table and column definitions. Exact names depend on the instance, such as the `mo_tables` / `mo_columns` family. |
| `mo_indexes` | Index ID, type (primary, unique, or secondary), algorithm, and component columns |
| `mo_partition_metadata` | Database name, table name, partitioning method, and partition count for partitioned tables. See the version information below. |
| `mo_partition_tables` | Name, position, and condition of each partition. `primary_table_id` links each partition to its parent table. |
| `mo_user` | User name, status, creation time, default role, and more |
| `mo_role` | Roles |
| `mo_user_grant` | Roles granted to users |
| `mo_role_grant` | Role inheritance |
| `mo_role_privs` | Privilege details for roles |
| User-defined-function tables | User-defined function metadata |

```sql
-- Example: view metadata for currently visible databases (requires the appropriate privileges)
SELECT datname, dat_type, created_time
FROM mo_catalog.mo_database
LIMIT 20;
```

### View partition definitions

View the table creation statement. Replace `your_database` and `your_table` with the actual database and table names:

```sql
SHOW CREATE TABLE your_database.your_table;
```

The returned statement includes the table's partition definitions.

MatrixOne 4.2.5 stores partition metadata in `mo_partition_metadata` and `mo_partition_tables`. On instances that use these system tables, run the following query to view each partition's condition. The query requires the appropriate privileges. Replace the database and table names with the actual names.

```sql
SELECT m.partition_method,
       p.partition_name,
       p.partition_ordinal_position,
       p.partition_expression_str
FROM mo_catalog.mo_partition_metadata AS m
JOIN mo_catalog.mo_partition_tables AS p
  ON p.primary_table_id = m.table_id
WHERE m.database_name = 'your_database'
  AND m.table_name = 'your_table'
ORDER BY p.partition_ordinal_position;
```

The result lists the partitioning method, name, and condition in partition order. System table schemas vary by engine version. `mo_table_partitions` has no `table_name` column, so that column cannot be used to filter by table name. Its contents also do not determine whether `RANGE` / `LIST` partitioning is supported. See [Limitations](limitations.md#partitioning) for partitioning restrictions.

## `information_schema` and `mysql`

- For tool compatibility with `information_schema.tables`, `columns`, `schemata`, and similar objects, prefer this layer.
- Compatibility is a **subset**. Some MySQL system tables or columns do not exist or always remain empty. Do not assume 100% compatibility with MySQL 8.0.

## Usage notes

1. **Read-only**: DML or DDL on system databases is generally rejected or can cause unexpected behavior.
2. **Privileges**: Ordinary business roles may not see all system tables. Administrative roles have broader visibility.
3. **Version differences**: Internal table columns evolve between versions. Automation should tolerate added columns and avoid depending on the column order returned by `SELECT *`.
4. **Cleanup**: Dedicated functions such as `PURGE_LOG` may be available for log cleanup. Do not modify underlying files or tables directly.

## Detailed system object reference

MatrixOne system databases and tables are where MatrixOne stores system information, allowing you to access system details through them. During initialization, MatrixOne Intelligence creates 5 system databases: `mo_catalog`, `information_schema`, `system_metrics`, `system`, and `mysql`. System databases and tables are default internal system components, and users can only perform read operations on them.

-----

### `mo_catalog` Database

`mo_catalog` is used to store metadata for MatrixOne objects, such as databases, tables, columns, system variables, tenants, users, and roles.

#### `mo_indexes` Table

| Column Attribute | Type | Description |
|---|---|---|
| id | BIGINT UNSIGNED(64) | Index ID |
| table\_id | BIGINT UNSIGNED(64) | ID of the table where the index is located |
| database\_id | BIGINT UNSIGNED(64) | ID of the database where the index is located |
| name | VARCHAR(64) | Name of the index |
| type | VARCHAR(11) | Type of index, including primary key index (PRIMARY), unique index (UNIQUE), secondary index (MULTIPLE) |
| algo | VARCHAR(11) | Algorithm used to create the index |
| algo\_table\_type | VARCHAR(11) | Hidden table type for multi-table indexes |
| algo\_params | VARCHAR(2048) | Index algorithm parameters |
| is\_visible | TINYINT(8) | Whether the index is visible, 1 for visible, 0 for invisible (currently all MatrixOne indexes are visible) |
| hidden | TINYINT(8) | Whether the index is hidden, 1 for hidden, 0 for not hidden |
| comment | VARCHAR(2048) | Comment for the index |
| column\_name | VARCHAR(256) | Column name of the index's constituent column |
| ordinal\_position | INT UNSIGNED(32) | Column sequence in the index, starting from 1 |
| options | TEXT(0) | Options information for the index |
| index\_table\_name | VARCHAR(5000) | Table name of the index table corresponding to this index, currently only unique indexes have index tables |

#### `mo_table_partitions` Table

This field reference describes the metadata table. Its structure varies by engine version. Prefer the methods in [View partition definitions](#view-partition-definitions) for the current instance.

| Column Attribute | Type | Description |
|---|---|---|
| table\_id | BIGINT UNSIGNED(64) | ID of the current partitioned table |
| database\_id | BIGINT UNSIGNED(64) | ID of the database to which the current partitioned table belongs |
| number | SMALLINT UNSIGNED(16) | Current partition number. All partitions are indexed in the order they are defined, where 1 is the number assigned to the first partition. |
| name | VARCHAR(64) | Name of the partition |
| partition\_type | VARCHAR(50) | Stores the partition type information of the table. If it is a partitioned table, its enumerated values are "KEY", "LINEAR\_KEY", "HASH", "LINEAR\_KEY\_51", "RANGE", "RANGE\_COLUMNS", "LIST", "LIST\_COLUMNS"; if it is not a partitioned table, the value of partition\_type is an empty string. Check partition support for the instance version rather than inferring it from this enumeration. |
| partition\_expression | VARCHAR(2048) | The partition function expression used in the `CREATE TABLE` or `ALTER TABLE` statement when creating the partitioned table. |
| description\_utf8 | TEXT(0) | This column is used for `RANGE` and `LIST` partitions. For `RANGE` partitions, it contains the value set in the partition's `VALUES LESS THAN` clause, which can be an integer or `MAXVALUE`. For `LIST` partitions, this column contains the values defined in the partition's `values in` clause, which is a comma-separated list of integer values. For partitions that are not `RANGE` or `LIST`, this column is always NULL.Availability depends on the engine version and partition metadata implementation. |
| comment | VARCHAR(2048) | The text of the comment. Otherwise, this value is empty. |
| options | TEXT(0) | Options information for the partition, currently `NULL` |
| partition\_table\_name | VARCHAR(1024) | Name of the partition sub-table corresponding to the current partition |

#### `mo_user` Table

| Column Attribute | Type | Description |
|---|---|---|
| user\_id | int | User ID, primary key |
| user\_host | varchar(100) | User host address |
| user\_name | varchar(100) | Username |
| authentication\_string | varchar(100) | Encrypted authentication string for the password |
| status | varchar(8) | Enabled, locked, invalid |
| created\_time | timestamp | User creation time |
| expired\_time | timestamp | User expiration time |
| login\_type | varchar(16) | ssl/password/other |
| creator | int | ID of the creator who created this user |
| owner | int | Administrator ID of this user |
| default\_role | int | Default role ID for this user |

#### `mo_database` Table

| Column Attribute | Type | Description |
|---|---|---|
| dat\_id | bigint unsigned | Primary key ID |
| datname | varchar(100) | Database name |
| dat\_catalog\_name | varchar(100) | Database catalog name, default `def` |
| dat\_createsql | varchar(100) | SQL statement for creating the database |
| owner | int unsigned | Role ID |
| creator | int unsigned | User ID |
| created\_time | timestamp | Creation time |
| account\_id | int unsigned | Tenant ID |
| dat\_type | varchar(23) | Database type, normal database or subscription database |

#### `mo_role` Table

| Column Attribute | Type | Description |
|---|---|---|
| role\_id | int unsigned | Role ID, primary key |
| role\_name | varchar(100) | Role name |
| creator | int unsigned | User ID |
| owner | int unsigned | MatrixOne Administrator/Tenant Administrator Owner ID |
| created\_time | timestamp | Creation time |
| comments | text | Comments |

#### `mo_user_grant` Table

| Column Attribute | Type | Description |
|---|---|---|
| role\_id | int unsigned | Authorized role ID, composite primary key |
| user\_id | int unsigned | User ID of the user granted the role, composite primary key |
| granted\_time | timestamp | Grant time |
| with\_grant\_option | bool | Whether the authorized user is allowed to authorize other users or roles |

#### `mo_role_grant` Table

| Column Attribute | Type | Description |
|---|---|---|
| granted\_id | int | ID of the role being granted, composite primary key |
| grantee\_id | int | ID of the role to be granted to other roles, composite primary key |
| operation\_role\_id | int | Operation role ID |
| operation\_user\_id | int | Operation user ID |
| granted\_time | timestamp | Grant time |
| with\_grant\_option | bool | Whether the authorized role is allowed to authorize other users or roles |

#### `mo_role_privs` Table

| Column Attribute | Type | Description |
|---|---|---|
| role\_id | int unsigned | Role ID, composite primary key |
| role\_name | varchar(100) | Role name: accountadmin/public |
| obj\_type | varchar(16) | Object type: account/database/table, composite primary key |
| obj\_id | bigint unsigned | Object ID, composite primary key |
| privilege\_id | int | Privilege ID, composite primary key |
| privilege\_name | varchar(100) | Privilege name: list of privileges |
| privilege\_level | varchar(100) | Privilege level, composite primary key |
| operation\_user\_id | int unsigned | Operation user ID |
| granted\_time | timestamp | Grant time |
| with\_grant\_option | bool | Whether authorization is allowed |

#### `mo_user_defined_function` Table

| Column Attribute | Type | Description |
|---|---|---|
| function\_id | INT(32) | ID of the function, primary key |
| name | VARCHAR(100) | Name of the function |
| owner | INT UNSIGNED(32) | Role ID of the creator of the function |
| args | TEXT(0) | Parameter list of the function |
| rettype | VARCHAR(20) | Return type of the function |
| body | TEXT(0) | Function body of the function |
| language | VARCHAR(20) | Language used by the function |
| db | VARCHAR(100) | Database where the function is located |
| definer | VARCHAR(50) | Name of the user who defined the function |
| modified\_time | TIMESTAMP(0) | Last modification time of the function |
| created\_time | TIMESTAMP(0) | Creation time of the function |
| type | VARCHAR(10) | Type of the function, default FUNCTION |
| security\_type | VARCHAR(10) | Security handling method, uniform value DEFINER |
| comment | VARCHAR(5000) | Comments for creating the function |
| character\_set\_client | VARCHAR(64) | Client character set: utf8mb4 |
| collation\_connection | VARCHAR(64) | Connection collation: utf8mb4\_0900\_ai\_ci |
| database\_collation | VARCHAR(64) | Database connection collation: utf8mb4\_0900\_ai\_ci |

#### `mo_mysql_compatibility_mode` Table

| Column Attribute | Type | Description |
|---|---|---|
| configuration\_id | INT(32) | Configuration item ID, auto-incrementing column, serving as the primary key to distinguish different configurations |
| account\_id | INT(32) | Tenant ID where the configuration is located |
| account\_name | VARCHAR(300) | Tenant name where the configuration is located |
| dat\_name | VARCHAR(5000) | Database name where the configuration is located |
| variable\_name | VARCHAR(300) | Name of the variable |
| variable\_value | VARCHAR(5000) | Value of the variable |
| system\_variables | BOOL(0) | Whether it is a system variable (in addition to system variables, compatibility variables are also added) |

#### `mo_pubs` Table

| Column Attribute | Type | Description |
|---|---|---|
| pub\_name | VARCHAR(64) | Publication name |
| database\_name | VARCHAR(5000) | Name of the published database |
| database\_id | BIGINT UNSIGNED(64) | ID of the published database, corresponding to `dat_id` in the `mo_database` table |
| all\_table | BOOL(0) | Whether the published database includes all tables within the database corresponding to `database_id` |
| table\_list | TEXT(0) | When not `all_table`, a list of tables included in the published database, where table names correspond one-to-one with tables under the database corresponding to `database_id` |
| account\_list | TEXT(0) | When not `all_account`, a list of accounts allowed to subscribe to this published database |
| created\_time | TIMESTAMP(0) | Time when the published database was created |
| owner | INT UNSIGNED(32) | Role ID corresponding to the creation of the published database |
| creator | INT UNSIGNED(32) | User ID corresponding to the creation of the published database |
| comment | TEXT(0) | Remarks for creating the published database |

#### `mo_stages` Table

| Column Attribute | Type | Description |
|---|---|---|
| stage\_id | INT UNSIGNED(32) | Data stage ID |
| stage\_name | VARCHAR(64) | Data stage name |
| url | TEXT(0) | Object storage path (without authentication), file system path |
| stage\_credentials | TEXT(0) | Authentication information, saved after encryption |
| stage\_status | VARCHAR(64) | ENABLED/DISABLED Default: DISABLED |
| created\_time | TIMESTAMP(0) | Creation time |
| comment | TEXT(0) | Comment |

#### `mo_sessions` View

| Column Name | Data Type | Description |
|---|---|---|
| node\_id | VARCHAR(65535) | Unique identifier for a MatrixOne node. Cannot be changed once started. |
| conn\_id | INT UNSIGNED | Unique number related to the client TCP connection in MatrixOne, automatically generated by Hakeeper. |
| session\_id | VARCHAR(65535) | Unique UUID to identify the session. A new UUID is generated for each new session. |
| account | VARCHAR(65535) | Name of the tenant. |
| user | VARCHAR(65535) | Name of the user. |
| host | VARCHAR(65535) | IP address and port of the CN node receiving client requests. |
| db | VARCHAR(65535) | Name of the database used when executing SQL. |
| session\_start | VARCHAR(65535) | Timestamp when the session was created. |
| command | VARCHAR(65535) | Type of MySQL command, such as COM\_QUERY, COM\_STMT\_PREPARE, COM\_STMT\_EXECUTE, etc. |
| info | VARCHAR(65535) | SQL statement being executed. An SQL statement may contain multiple statements. |
| txn\_id | VARCHAR(65535) | Unique identifier of the related transaction. |
| statement\_id | VARCHAR(65535) | Unique identifier (UUID) of the SQL statement. |
| statement\_type | VARCHAR(65535) | Type of the SQL statement, such as SELECT, INSERT, UPDATE, etc. |
| query\_type | VARCHAR(65535) | Kind of SQL statement, such as DQL (Data Query Language), TCL (Transaction Control Language), etc. |
| sql\_source\_type | VARCHAR(65535) | Source of the SQL statement, such as external or internal. |
| query\_start | VARCHAR(65535) | Timestamp when the SQL statement started execution. |
| client\_host | VARCHAR(65535) | IP address and port number of the client. |
| role | VARCHAR(65535) | Role name of the user. |

#### `mo_configurations` View

| Column Name | Data Type | Description |
|---|---|---|
| node\_type | VARCHAR(65535) | Type of the node: cn (compute node), tn (transaction node), log (log node), proxy (proxy). |
| node\_id | VARCHAR(65535) | Unique identifier of the node. |
| name | VARCHAR(65535) | Name of the configuration item, possibly with a nested structure prefix. |
| current\_value | VARCHAR(65535) | Current value of the configuration item. |
| default\_value | VARCHAR(65535) | Default value of the configuration item. |
| internal | VARCHAR(65535) | Indicates whether the configuration parameter is an internal parameter. |

#### `mo_locks` View

| Column Name | Data Type | Description |
|---|---|---|
| cn\_id | VARCHAR(65535) | UUID of the CN node. |
| txn\_id | VARCHAR(65535) | Transaction holding the lock. |
| table\_id | VARCHAR(65535) | Table being locked. |
| lock\_key | VARCHAR(65535) | Lock type. Can be `point` or `range`. |
| lock\_content | VARCHAR(65535) | Content of the lock, represented in hexadecimal. For `range` locks, it represents an interval; for `point` locks, it represents a single value. |
| lock\_mode | VARCHAR(65535) | Lock mode. Can be `shared` or `exclusive`. |
| lock\_status | VARCHAR(65535) | Lock status, can be `wait`, `acquired`, or `none`.\<br\>wait: No transaction holds the lock, but there are transactions waiting on the lock.\<br\>acquired: A transaction holds the lock.\<br\>none: No transaction holds the lock, and no transactions are waiting on the lock. |
| lock\_wait | VARCHAR(65535) | Transactions waiting on this lock. |

#### `mo_variables` View

| Column Name | Data Type | Description |
|---|---|---|
| configuration\_id | INT(32) | Auto-incrementing column, used to uniquely identify each configuration item. |
| account\_id | INT(32) | Unique identifier of the tenant. |
| account\_name | VARCHAR(300) | Name of the tenant. |
| dat\_name | VARCHAR(5000) | Name of the database. |
| variable\_name | VARCHAR(300) | Name of the configuration variable. |
| variable\_value | VARCHAR(5000) | Value of the configuration variable. |
| system\_variables | BOOL(0) | Indicates whether the configuration variable is a system-level variable. |

#### `mo_transactions` View

| Column Name | Data Type | Description |
|---|---|---|
| cn\_id | VARCHAR(65535) | Unique ID of the CN (Compute Node). |
| txn\_id | VARCHAR(65535) | Unique ID of the transaction. |
| create\_ts | VARCHAR(65535) | Timestamp of transaction creation, following RFC3339Nano format ("2006-01-02T15:04:05.999999999Z07:00"). |
| snapshot\_ts | VARCHAR(65535) | Represents the transaction's snapshot timestamp, expressed as physical and logical time. |
| prepared\_ts | VARCHAR(65535) | Represents the transaction's prepared timestamp, expressed as physical and logical time. |
| commit\_ts | VARCHAR(65535) | Represents the transaction's commit timestamp, expressed as physical and logical time. |
| txn\_mode | VARCHAR(65535) | Identifies the transaction mode, can be pessimistic or optimistic. |
| isolation | VARCHAR(65535) | Represents the transaction's isolation level, can be SI (Snapshot Isolation) or RC (Read Committed). |
| user\_txn | VARCHAR(65535) | Indicates a user transaction, i.e., a transaction created by a user connecting to MatrixOne via a client and performing SQL operations. |
| txn\_status | VARCHAR(65535) | Represents the current status of the transaction. Possible values include active, committed, aborting, aborted. In distributed transaction 2PC mode, it will also include prepared and committing. |
| table\_id | VARCHAR(65535) | Represents the ID of the table involved in the transaction. |
| lock\_key | VARCHAR(65535) | Represents the type of lock, can be `range` or `point`. |
| lock\_content | VARCHAR(65535) | For point locks, it represents a single value; for range locks, it represents a range, usually in the "low - high" format. Note that a transaction may involve multiple locks, but only the first lock is displayed here. |
| lock\_mode | VARCHAR(65535) | Represents the mode of the lock, can be `exclusive` or `shared`. |

#### `mo_columns` Table

| Column Attribute | Type | Description |
|---|---|---|
| att\_uniq\_name | varchar(256) | Primary key. Hidden composite primary key, format similar to "${att\_relname\_id}-${attname}" |
| account\_id | int unsigned | Tenant ID |
| att\_database\_id | bigint unsigned | Database ID |
| att\_database | varchar(256) | Database Name |
| att\_relname\_id | bigint unsigned | Table ID |
| att\_relname | varchar(256) | The table to which this column belongs. (Refer to `mo_tables.relname`) |
| attname | varchar(256) | Column name |
| atttyp | varchar(256) | Data type of this column (deleted columns are 0). |
| attnum | int | Column number. Regular columns are numbered starting from 1. |
| att\_length | int | Byte size of the type |
| attnotnull | tinyint(1) | Indicates a not-null constraint. |
| atthasdef | tinyint(1) | This column has a default expression or generated expression. |
| att\_default | varchar(1024) | Default expression |
| attisdropped | tinyint(1) | This column has been dropped and is no longer valid. Dropped columns physically still exist in the table, but the parser ignores them, so they cannot be accessed via SQL. |
| att\_constraint\_type | char(1) | p = Primary key constraint\<br\>n = No constraint |
| att\_is\_unsigned | tinyint(1) | Whether it is unsigned |
| att\_is\_auto\_increment | tinyint(1) | Whether it is auto-increment |
| att\_comment | varchar(1024) | Comment |
| att\_is\_hidden | tinyint(1) | Whether it is hidden |
| attr\_has\_update | tinyint(1) | This column contains an update expression |
| attr\_update | varchar(1024) | Update expression |
| attr\_is\_clusterby | tinyint(1) | Whether this column is used as a `cluster by` keyword to create the table |
| attr\_seqnum | SMALLINT UNSIGNED(0) | Sequence number for each column |
| attr\_enum | varchar(65535) | If the type of this column is ENUM, it represents the ENUM type value represented by this column, otherwise it is empty. |

#### `mo_tables` Table

| Column Attribute | Type | Description |
|---|---|---|
| rel\_id | bigint unsigned | Primary key, Table ID |
| relname | varchar(100) | Name of table, index, view, etc. |
| reldatabase | varchar(100) | Database containing this relation, refer to `mo_database.datname` |
| reldatabase\_id | bigint unsigned | ID of the database containing this relation, refer to `mo_database.datid` |
| relpersistence | varchar(100) | p = Permanent table\<br\> t = Temporary table |
| relkind | varchar(100) | r = Ordinary table\<br\> e = External table\<br\> i = Index\<br\> S = Sequence\<br\> v = View\<br\> m = Materialized view |
| rel\_comment | varchar(100) | Table comment |
| rel\_createsql | varchar(100) | SQL statement for creating the table |
| created\_time | timestamp | Creation time |
| creator | int unsigned | Creator ID |
| owner | int unsigned | Creator's default role ID |
| account\_id | int unsigned | Tenant ID |
| partitioned | blob | Partitioned by statement |
| partition\_info | blob | Partition information |
| viewdef | blob | View definition statement |
| constraint | varchar(5000) | Constraints associated with the table |
| rel\_version | INT UNSIGNED(0) | Primary key, table version number |
| catalog\_version | INT UNSIGNED(0) | System table version number |

-----

### `system_metrics` Database

`system_metrics` collects status and statistical information on SQL statements, CPU, and memory resource usage.

Some common column types in `metrics` tables, with descriptions as follows:

  -**collecttime**: Collection time.
  -**value**: Collected `metrics` value.
  -**node**: UUID of the MatrixOne node.
  -**role**: MatrixOne node role, including CN, TN, and Log.
  -**account**: Defaults to the "sys" tenant, which is the account that triggered the SQL request.
  -**type**: SQL type, can be `select`, `insert`, `update`, `delete`, or `other` type.

#### `metric` Table

| Column Attribute | Type | Description |
|---|---|---|
| metric\_name | VARCHAR(128) | Metric name, e.g., `sql_statement_total`, `server_connections`, `process_cpu_percent`, `sys_memory_used`, etc. |
| collecttime | DATETIME | Metric data collection time |
| value | DOUBLE | Metric value |
| node | VARCHAR(36) | MatrixOne node UUID |
| role | VARCHAR(32) | MatrixOne node role |
| account | VARCHAR(128) | Tenant name, default `sys` |
| type | VARCHAR(32) | SQL type, e.g., INSERT, SELECT, UPDATE |

The following tables are views of the `metric` table:

  * `sql_statement_total` table: Counter for executed SQL statements.
  * `sql_statement_errors` table: Counter for SQL statements that encountered errors.
  * `sql_transaction_total` table: Counter for transactional SQL statements.
  * `sql_transaction_errors` table: Counter for transaction statements that executed with errors.
  * `server_connections` table: Number of server connections.
  * `server_storage_usage`: Server storage usage.
  * `process_cpu_percent` table: Percentage of CPU process busyness.
  * `process_resident_memory_bytes` table: Amount of resident memory, in bytes.
  * `process_open_fds` table: Number of open file descriptors.
  * `sys_cpu_seconds_total` table: Total system CPU time, in seconds, normalized by core count.
  * `sys_cpu_combined_percent` table: System CPU busyness percentage, average of all logical cores.
  * `sys_memory_used` table: Used system memory in bytes.
  * `sys_memory_available` table: Available system memory in bytes.
  * `sys_disk_read_bytes` table: System disk read in bytes.
  * `sys_disk_write_bytes` table: System disk write in bytes.
  * `sys_net_recv_bytes` table: System network received in bytes.
  * `sys_net_sent_bytes` table: System network sent in bytes.

-----

### `system` Database

The `System` database stores MatrixOne historical SQL statements, system logs, and error information.

#### `statement_info` Table

The `statement_info` table records user and system SQL statements and their detailed information.

| Column Attribute | Type | Description |
|---|---|---|
| statement\_id | VARCHAR(36) | Unique ID of the statement |
| transaction\_id | VARCHAR(36) | Unique ID of the transaction |
| session\_id | VARCHAR(36) | Unique ID of the account |
| account | VARCHAR(1024) | Tenant name |
| user | VARCHAR(1024) | User name |
| host | VARCHAR(1024) | User client IP |
| database | VARCHAR(1024) | Current database where the session is active |
| statement | TEXT | SQL statement |
| statement\_tag | TEXT | Comment tag in the statement (reserved) |
| statement\_fingerprint | TEXT | Comment tag in the statement (reserved) |
| node\_uuid | VARCHAR(36) | Node UUID, i.e., the node that generated the data |
| node\_type | VARCHAR(64) | Node type within MatrixOne, belonging to TN/CN/Log |
| request\_at | DATETIME | Datetime when the request was accepted |
| response\_at | DATETIME | Datetime when the response was sent |
| duration | BIGINT | Execution time, unit: ns |
| status | VARCHAR(32) | SQL statement execution status: Running, Success, Failed |
| err\_code | VARCHAR(1024) | Error code |
| error | TEXT | Error message |
| exec\_plan | JSON | Statement execution plan |
| rows\_read | BIGINT | Total rows read |
| bytes\_scan | BIGINT | Total bytes scanned |
| stats | JSON | Global statistics from `exec_plan` |
| statement\_type | VARCHAR(1024) | Statement type: [Insert, Delete, Update, Drop Table, Drop User, ...] |
| query\_type | VARCHAR(1024) | Query type: [DQL, DDL, DML, DCL, TCL] |
| role\_id | BIGINT | Role ID |
| sql\_source\_type | TEXT | SQL statement source type: internal\_sql, external\_sql, cloud\_nonuser\_sql |
| result\_count | BIGINT(64) | Number of rows in SQL execution result |
| aggr\_count | BIGINT(64) | Number of aggregations |

#### `rawlog` Table

The `rawlog` table records very detailed system logs.

| Column Attribute | Type | Description |
|---|---|---|
| raw\_item | VARCHAR(1024) | Original log item |
| node\_uuid | VARCHAR(36) | Node UUID, i.e., the node that generated the data |
| node\_type | VARCHAR(64) | Node type within MatrixOne, belonging to TN/CN/Log |
| span\_id | VARCHAR(16) | Unique ID of the span |
| trace\_id | VARCHAR(36) | Unique trace UUID |
| logger\_name | VARCHAR(1024) | Name of the logger |
| timestamp | DATETIME | Timestamp of the action |
| level | VARCHAR(1024) | Log level, e.g., debug, info, warn, error, panic, fatal |
| caller | VARCHAR(1024) | Location where the log was generated: package/file.go:123 |
| message | TEXT | Log message |
| extra | JSON | Dynamic fields of the log |
| err\_code | VARCHAR(1024) | Error log |
| error | TEXT | Error message |
| stack | VARCHAR(4096) | Stack information for log\_info and error\_info |
| span\_name | VARCHAR(1024) | Span name, e.g., step name of execution plan, function name in code, ... |
| parent\_span\_id | VARCHAR(16) | Unique ID of the parent span |
| start\_time | DATETIME | Start time of the span |
| end\_time | DATETIME | End time of the span |
| duration | BIGINT | Execution time, unit: ns |
| resource | JSON | Static resource information |
| span\_kind | VARCHAR(1024) | Span type. internal: MO internal generated trace (default); statement: trace\_id==statement\_id; remote: communication via morpc |
| statement\_id | VARCHAR(36) | ID of the statement |
| session\_id | VARCHAR(36) | ID of the session |

The other 3 tables (`log_info`, `span_info`, and `error_info`) are views of the `statement_info` and `rawlog` tables.

-----

### `information_schema` Database

**Information Schema** provides an ANSI standard way to view system metadata. In addition to tables included for MySQL compatibility, MatrixOne also provides many custom `information_schema` tables.

Many `INFORMATION_SCHEMA` tables have corresponding `SHOW` commands. Querying `INFORMATION_SCHEMA` allows joins between tables.

#### MySQL Compatibility Tables

| Table Name | Description |
|---|---|
| KEY\_COLUMN\_USAGE | Describes key constraints on columns, such as primary key constraints. |
| COLUMNS | Provides a list of columns for all tables. |
| PROFILING | Provides some analysis information when SQL statements are executed. |
| PROCESSLIST | Provides information similar to executing the `SHOW PROCESSLIST` command. |
| USER\_PRIVILEGES | Lists privileges associated with the current user. |
| SCHEMATA | Provides information similar to executing `SHOW DATABASES`. |
| CHARACTER\_SETS | Provides a list of character sets supported by the server. |
| TRIGGERS | Provides information similar to executing `SHOW TRIGGERS`. |
| TABLES | Provides a list of tables visible to the current user. Similar to executing `SHOW TABLES`. |
| PARTITIONS | Provides partition information for tables. |
| VIEWS | Provides information about views in the database. |
| ENGINES | Provides a list of supported storage engines. |
| ROUTINES | Provides some information about stored procedures. |
| PARAMETERS | Provides information about parameters and return values of stored procedures. |
| KEYWORDS | Provides information about keywords in the database. See [Keywords](Language-Structure/keywords.md) for details. |

#### `CHARACTER_SETS` Table

The columns in the `CHARACTER_SETS` table are described as follows:

  - `CHARACTER_SET_NAME`: The name of the character set.
  - `DEFAULT_COLLATE_NAME`: The default collation name for the character set.
  - `DESCRIPTION`: A description of the character set.
  - `MAXLEN`: The maximum length required to store a character in this character set.

#### `COLUMNS` View

The columns in the `COLUMNS` view are described as follows:

  - `TABLE_CATALOG`: The name of the catalog to which the table containing this column belongs. This value is always `def`.
  - `TABLE_SCHEMA`: The name of the schema where the table containing the column is located.
  - `TABLE_NAME`: The name of the table containing the column.
  - `COLUMN_NAME`: The name of the column.
  - `ORDINAL_POSITION`: The position of the column in the table.
  - `COLUMN_DEFAULT`: The default value for the column. This value is `NULL` if the explicit default value is `NULL`, or if the column definition does not contain a `default` clause.
  - `IS_NULLABLE`: Whether the column can be nullable. The value is `YES` if the column can store null values; otherwise, it is `NO`.
  - `DATA_TYPE`: The data type in the column.
  - `CHARACTER_MAXIMUM_LENGTH`: For string columns, the maximum length in characters.
  - `CHARACTER_OCTET_LENGTH`: For string columns, the maximum length in bytes.
  - `NUMERIC_PRECISION`: Numeric precision for numeric type columns.
  - `NUMERIC_SCALE`: Numeric scale for numeric type columns.
  - `DATETIME_PRECISION`: For time type columns, fractional seconds precision.
  - `CHARACTER_SET_NAME`: Character set name for string columns.
  - `COLLATION_NAME`: Name of the collation for string columns.
  - `COLUMN_TYPE`: Column type.
  - `COLUMN_KEY`: Whether this column is indexed. This field can have the following values:
      - `Empty`: This column is not indexed, or this column is indexed and is the second column in a multi-column non-unique index.
      - `PRI`: This column is a primary key or one of multiple primary keys.
      - `UNI`: This column is the first column of a unique index.
      - `MUL`: This column is the first column of a non-unique index, where a given value is allowed to appear multiple times.
  - `EXTRA`: Any additional information for the given column.
  - `PRIVILEGES`: Privileges that the current user has on this column.
  - `COLUMN_COMMENT`: Description included in the column definition.
  - `GENERATION_EXPRESSION`: For generated columns, this value shows the expression used to calculate the column value. For non-generated columns, this value is empty.
  - `SRS_ID`: This value applies to spatial columns. It contains the column's `SRID` value, which indicates a spatial reference system for values stored in that column.

#### `ENGINES` Table

The columns in the `ENGINES` table are described as follows:

  - `ENGINE`: The name of the storage engine.
  - `SUPPORT`: The server's level of support for the storage engine.
  - `COMMENT`: A short comment on the storage engine.
  - `TRANSACTIONS`: Whether the storage engine supports transactions.
  - `XA`: Whether the storage engine supports XA transactions.
  - `SAVEPOINTS`: Whether the storage engine supports `savepoints`.

#### `PARTITIONS` View

The columns in the `PARTITIONS` view are described as follows:

  - `TABLE_CATALOG`: The name of the catalog to which the table containing this column belongs. This value is always `def`.
  - `TABLE_SCHEMA`: The name of the schema where the table containing the column is located.
  - `TABLE_NAME`: The name of the table containing the column.
  - `PARTITION_NAME`: The name of the partition.
  - `SUBPARTITION_NAME`: If the row in the `PARTITIONS` table represents a subpartition, this is the name of that subpartition; otherwise, it is empty.
  - `PARTITION_ORDINAL_POSITION`: All partitions are indexed in the order they are defined, where 1 is the number assigned to the first partition. As partitions are added, deleted, and reorganized, the index may change; the number displayed in this column reflects the current order, taking into account any index changes.
  - `SUBPARTITION_ORDINAL_POSITION`: Within a given partition, subpartitions are indexed and re-indexed in the same way as partitions within a table.
  - `PARTITION_METHOD`: One of `RANGE`, `LIST`, `HASH`, `LINEAR HASH`, `KEY`, or `LINEAR KEY`. Check partition support for the instance version rather than inferring it from this enumeration.
  - `SUBPARTITION_METHOD`: One of `HASH`, `LINEAR HASH`, `KEY`, or `LINEAR KEY`.
  - `PARTITION_EXPRESSION`: The partition function expression used in the `CREATE TABLE` or `ALTER TABLE` statement when creating the table's current partitioning scheme.
  - `SUBPARTITION_EXPRESSION`: This is similar to `PARTITION_EXPRESSION`, used to define how the table is subpartitioned. If the table has no subpartitions, this column is empty.
  - `PARTITION_DESCRIPTION`: This column applies to `RANGE` and `LIST` partitions. For `RANGE` partitions, it contains the value set in the partition's `VALUES LESS THAN` clause, which can be an integer or `MAXVALUE`. For `LIST` partitions, this column contains the values defined in the partition's `VALUES IN` clause, which is a comma-separated set of integer values. For partitions whose `PARTITION_METHOD` is not `RANGE` or `LIST`, this column is always empty. Check partition support for the instance version rather than inferring it from this enumeration.
  - `TABLE_ROWS`: The number of table rows in the partition.
  - `AVG_ROW_LENGTH`: The average length of rows stored in this partition or subpartition, in bytes. This is the same as the result of `DATA_LENGTH` divided by `TABLE_ROWS`.
  - `DATA_LENGTH`: The total length of all rows stored in this partition or subpartition, in bytes; i.e., the total number of bytes stored in the partition or subpartition.
  - `MAX_DATA_LENGTH`: Maximum data length of the partition.
  - `INDEX_LENGTH`: The length of the index file for this partition or subpartition, in bytes.
  - `DATA_FREE`: The number of bytes allocated to the partition or subpartition but not used.
  - `CREATE_TIME`: The time the partition or subpartition was created.
  - `UPDATE_TIME`: The time the partition or subpartition was last modified.
  - `CHECK_TIME`: The time the table belonging to this partition or subpartition was last checked.
  - `CHECKSUM`: The checksum value, if any; otherwise, it is empty.
  - `PARTITION_COMMENT`: If the partition has a comment, this is the text of the comment. If not, the value is empty. The maximum length for partition comments is defined as 1024 characters, and the display width of the `PARTITION_COMMENT` column is also 1024 characters to match this limit.
  - `NODEGROUP`: The node group to which this partition belongs.
  - `TABLESPACE_NAME`: The name of the tablespace to which this partition belongs. This value is always `DEFAULT`.

#### `PROCESSLIST` View

The fields in the `PROCESSLIST` view are described as follows:

  - `NODE_ID`: CN node UUID.
  - `CONN_ID`: User connection ID.
  - `SESSION_ID`: Session ID.
  - `ACCOUNT`: Tenant name.
  - `USER`: User name.
  - `HOST`: CN node listening address.
  - `DB`: Current connected database.
  - `SESSION_START`: Session creation time.
  - `COMMAND`: MySQL protocol Command of the statement.
  - `INFO`: SQL statement being processed.
  - `TXN_ID`: Transaction ID.
  - `STATEMENT_ID`: Statement ID.
  - `STATEMENT_TYPE`: Statement type, e.g., Select/Update/Delete.
  - `QUERY_TYPE`: Query type, e.g., DQL/DDL/DML.
  - `SQL_SOURCE_TYPE`: SQL statement source type, external or internal SQL: external\_sql/internal\_sql.
  - `QUERY_START`: Query start time.
  - `CLIENT_HOST`: Client address.

#### `SCHEMATA` View

The `SCHEMATA` view provides information about databases, with data equivalent to the result of the `SHOW DATABASES` statement. The fields in the `SCHEMATA` view are described as follows:

  - `CATALOG_NAME`: The catalog to which the database belongs.
  - `SCHEMA_NAME`: The name of the database.
  - `DEFAULT_CHARACTER_SET_NAME`: The default character set of the database.
  - `DEFAULT_COLLATION_NAME`: The default collation of the database.
  - `SQL_PATH`: The value of this item is always `NULL`.
  - `DEFAULT_TABLE_ENCRYPTION`: Defines the *default encryption* setting for the database and general tablespaces.

#### `TABLES` View

The columns in the `TABLES` view are described as follows:

  - `TABLE_CATALOG`: The name of the catalog to which the table belongs. This value is always `def`.
  - `TABLE_SCHEMA`: The name of the schema to which the table belongs.
  - `TABLE_NAME`: The name of the table.
  - `TABLE_TYPE`: The type of the table. Basic table type is `BASE TABLE`, view table type is `VIEW`, and `INFORMATION_SCHEMA` table type is `SYSTEM VIEW`.
  - `ENGINE`: The type of storage engine.
  - `VERSION`: Version. Default value is `10`.
  - `ROW_FORMAT`: Row storage format. Values are `Fixed`, `Dynamic`, `Compressed`, `Redundant`, `Compact`.
  - `TABLE_ROWS`: Number of rows in the table. For `INFORMATION_SCHEMA` tables, `TABLE_ROWS` is `NULL`.
  - `AVG_ROW_LENGTH`: Average row length of the table. `AVG_ROW_LENGTH` = `DATA_LENGTH` / `TABLE_ROWS`.
  - `DATA_LENGTH`: Data length. `DATA_LENGTH` = `TABLE_ROWS` \* sum of stored lengths of columns in tuples.
  - `MAX_DATA_LENGTH`: Maximum data length. This value is currently `0`, indicating no upper limit on data length.
  - `INDEX_LENGTH`: Index length. `INDEX_LENGTH` = `TABLE_ROWS` \* total length of columns in index tuples.
  - `DATA_FREE`: Data fragment. This value is currently `0`.
  - `AUTO_INCREMENT`: Current step of the auto-increment primary key.
  - `CREATE_TIME`: Time when the table was created.
  - `UPDATE_TIME`: Time when the table was updated.
  - `CHECK_TIME`: Time when the table was checked.
  - `TABLE_COLLATION`: Collation of strings in the table.
  - `CHECKSUM`: Checksum.
  - `CREATE_OPTIONS`: Creation options.
  - `TABLE_COMMENT`: Table comments and remarks.

#### `USER_PRIVILEGES` Table

The `USER_PRIVILEGES` table provides information about global privileges.

The fields in the `USER_PRIVILEGES` table are described as follows:

- `GRANTEE`: The authorized username, in the format `'user_name'@'host_name'`.
- `TABLE_CATALOG`: The name of the catalog to which the table belongs. The value is `def`.
- `PRIVILEGE_TYPE`: The type of privilege to be granted. Each row displays only one privilege type.
- `IS_GRANTABLE`: If you have the `GRANT OPTION` privilege, the value is `YES`; otherwise, the value is `NO`.

#### `VIEWS` View

- `TABLE_CATALOG`: The name of the catalog to which the view belongs. The value is `def`.
- `TABLE_SCHEMA`: The name of the database to which the view belongs.
- `TABLE_NAME`: The name of the view.
- `VIEW_DEFINITION`: Provides the `SELECT` statement that defines the view. This includes most of what is seen in the**Create Table** column generated by `SHOW Create VIEW`.
- `CHECK_OPTION`: The value of the `CHECK_OPTION` attribute. Values are `NONE`, `CASCADE`, or `LOCAL`.
- `IS_UPDATABLE`: When `CREATE VIEW` is set, a flag named view updatability flag is set. If UPDATE and DELETE (and similar operations) are legal for the view, the flag is set to `YES (true)`. Otherwise, the flag is set to `NO (false)`.
- `DEFINER`: The account of the user who created the view, in the format `username@hostname`.
- `SECURITY_TYPE`: The `SQL SECURITY` characteristic of the view. Values are `DEFINER` or `INVOKER`.
- `CHARACTER_SET_CLIENT`: The session value of the `character_set_client` system variable when the view was created.
- `COLLATION_CONNECTION`: The session value of the `collation_connection` system variable when the view was created.
- `INDEX_COMMENT`: Any comments provided for indexes with the comment attribute when the index was created.
- `IS_VISIBLE`: Indicates whether the index is visible to the optimizer. Currently, this field has no meaning in MO.
- `EXPRESSION`: Represents an expression or function in the index. Currently, this field has no meaning in MO.

#### `STATISTICS` View

Get detailed information about database table indexes and statistics. For example, you can check if an index is unique, understand the column order in an index, and estimate the number of unique values in an index.

- `TABLE_CATALOG`: The catalog name of the table (always 'def').
- `TABLE_SCHEMA`: The database name to which the table belongs.
- `TABLE_NAME`: The name of the table.
- `NON_UNIQUE`: Indicates whether the index allows duplicate values. If 0, the index is unique.
- `INDEX_SCHEMA`: The database name to which the index belongs.
- `INDEX_NAME`: The name of the index.
- `SEQ_IN_INDEX`: The position of the column in the index.
- `COLUMN_NAME`: The name of the column.
- `COLLATION`: The collation of the column.
- `CARDINALITY`: An estimate of the number of unique values in the index.
- `SUB_PART`: The length of the index part. For the entire column, this value is NULL.
- `PACKED`: Indicates whether compressed values are used for storage.
- `NULLABLE`: Indicates whether the column allows NULL values.
- `INDEX_TYPE`: The type of index (e.g., BTREE, HASH, etc.).
- `COMMENT`: Comment information for the index.
- `INDEX_COMMENT`: Any comments provided for indexes with the comment attribute when the index was created.
- `IS_VISIBLE`: Indicates whether the index is visible to the optimizer. Currently, this field has no meaning in MO.
- `EXPRESSION`: Represents an expression or function in the index. Currently, this field has no meaning in MO.

### `mysql` Database

#### Authorization System Tables

The authorization system tables contain information about user accounts and their privileges:

- `user`: User accounts, global privileges, and other non-privilege columns.

- `db`: Database-level privileges.

- `tables_priv`: Table-level privileges.

- `columns_priv`: Column-level privileges.

- `procs_priv`: Privileges for stored procedures and stored functions.
