# 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_table_partitions` | Partition definitions. **RANGE/LIST and other types may be unsupported**. See [Limitations](limitations.md). |
| `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;
```

## `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.
