diff --git a/docs/MatrixOne/Reference/1.1-System-tables.md b/docs/MatrixOne/Reference/1.1-System-tables.md index 7cd3a1960..9dc52ee2c 100644 --- a/docs/MatrixOne/Reference/1.1-System-tables.md +++ b/docs/MatrixOne/Reference/1.1-System-tables.md @@ -11,69 +11,22 @@ The system can only modify system databases and tables, and users can only read Start with MatrixOne 0.6 has introduced the concept of multi-account, the default `sys` account and other accounts have slightly different behaviors. The system table `mo_account`, which serves the multi-tenancy management, is only visible for the `sys` account; the other accounts don't see this table. -### mo_database table - -| Column | Type | comments | -| ---------------- | --------------- | --------------------------------------- | -| dat_id | bigint unsigned | Primary key ID | -| datname | varchar(100) | Database name | -| dat_catalog_name | varchar(100) | Database catalog name, default as `def` | -| dat_createsql | varchar(100) | Database creation SQL statement | -| owner | int unsigned | Role id | -| creator | int unsigned | User id | -| created_time | timestamp | Create time | -| account_id | int unsigned | Account id | -| dat_type | varchar(23) | Database type, common library or subscription library | - -### mo_tables table - -| Column | Type | comments | -| -------------- | --------------- | ------------------------------------------------------------ | -| rel_id | bigint unsigned | Primary key, table ID | -| relname | varchar(100) | Name of the table, index, view, and so on. | -| reldatabase | varchar(100) | The database that contains this relation. reference mo_database.datname | -| reldatabase_id | bigint unsigned | The database id that contains this relation. reference mo_database.datid | -| relpersistence | varchar(100) | p = permanent table, t = temporary table | -| relkind | varchar(100) | r = ordinary table, e = external table, i = index, S = sequence, v = view, m = materialized view | -| rel_comment | varchar(100) | | -| rel_createsql | varchar(100) | Table creation SQL statement | -| created_time | timestamp | Create time | -| creator | int unsigned | Creator ID | -| owner | int unsigned | Creator's default role id | -| account_id | int unsigned | Account id | -| partitioned | blob | Partition by statement | -| partition_info | blob | the information of partition | -| viewdef | blob | View definition statement | -| constraint | varchar(5000) | Table related constraints | -| rel_version | INT UNSIGNED(0) | Version number of Primary key or table | -| catalog_version | INT UNSIGNED(0) | Version number of the system table | - -### mo_columns table +### mo_indexes table -| Column | type | comments | -| --------------------- | --------------- | ------------------------------------------------------------ | -| att_uniq_name | varchar(256) | Primary Key. Hidden, composite primary key, format is like "${att_relname_id}-${attname}" | -| account_id | int unsigned | accountID | -| att_database_id | bigint unsigned | databaseID | -| att_database | varchar(256) | database Name | -| att_relname_id | bigint unsigned | table id | -| att_relname | varchar(256) | The table this column belongs to.(references mo_tables.relname) | -| attname | varchar(256) | The column name | -| atttyp | varchar(256) | The data type of this column (zero for a dropped column). | -| attnum | int | The number of the column. Ordinary columns are numbered from 1 up. | -| att_length | int | bytes count for the type. | -| attnotnull | tinyint(1) | This represents a not-null constraint. | -| atthasdef | tinyint(1) | This column has a default expression or generation expression. | -| att_default | varchar(1024) | default expression | -| attisdropped | tinyint(1) | This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL. | -| att_constraint_type | char(1) | p = primary key constraint, n=no constraint | -| att_is_unsigned | tinyint(1) | unsigned or not | -| att_is_auto_increment | tinyint(1) | auto increment or not | -| att_comment | varchar(1024) | comment | -| att_is_hidden | tinyint(1) | hidden or not | -| attr_has_update | tinyint(1) | This columns has update expression | -| attr_update | varchar(1024) | update expression | -| attr_is_clusterby | tinyint(1) | Whether this column is used as the cluster by keyword to create the table | +| Column | Type | comments | +| -----------------| --------------- | ----------------- | +| id | BIGINT UNSIGNED(64) | index ID | +| table_id | BIGINT UNSIGNED(64) | ID of the table where the index resides | +| database_id | BIGINT UNSIGNED(64) | ID of the database where the index resides | +| name | VARCHAR(64) | name of the index | +| type | VARCHAR(11) | The type of index, including primary key index (PRIMARY), unique index (UNIQUE), secondary index (MULTIPLE) | +| is_visible | TINYINT(8) | Whether the index is visible, 1 means visible, 0 means invisible (currently all MatrixOne indexes are visible indexes) | +| hidden | TINYINT(8) | Whether the index is hidden, 1 is a hidden index, 0 is a non-hidden index| +| comment | VARCHAR(2048) | Comment information for the index | +| column_name | VARCHAR(256) | The column name of the constituent columns of the index | +| ordinal_position | INT UNSIGNED(32) | Column ordinal in index, starting from 1 | +| options | TEXT(0) | options option information for index | +| index_table_name | VARCHAR(5000) | The table name of the index table corresponding to the index, currently only the unique index contains the index table | ### mo_table_partitions table @@ -90,6 +43,22 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | options | TEXT(0) | Partition options information, currently set to NULL. | | partition_table_name | VARCHAR(1024) | The name of the subtable corresponding to the current partition. | +### mo_user table + +| Column | Type | comments | +| --------------------- | ------------ | ------------------- | +| user_id | int | user id, primary key | +| user_host | varchar(100) | user host address | +| user_name | varchar(100) | user name | +| authentication_string | varchar(100) | authentication string encrypted with password | +| status | varchar(8) | open,locked,expired | +| created_time | timestamp | user created time | +| expired_time | timestamp | user expired time | +| login_type | varchar(16) | ssl/password/other | +| creator | int | the creator id who created this user | +| owner | int | the admin id for this user | +| default_role | int | the default role id for this user | + ### mo_account table (Only visible for `sys` account) | Column | Type | comments | @@ -102,6 +71,20 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | suspended_time | TIMESTAMP | Time of the account's status is changed | | version | bigint unsigned | the version status of the current account| +### mo_database table + +| Column | Type | comments | +| ---------------- | --------------- | --------------------------------------- | +| dat_id | bigint unsigned | Primary key ID | +| datname | varchar(100) | Database name | +| dat_catalog_name | varchar(100) | Database catalog name, default as `def` | +| dat_createsql | varchar(100) | Database creation SQL statement | +| owner | int unsigned | Role id | +| creator | int unsigned | User id | +| created_time | timestamp | Create time | +| account_id | int unsigned | Account id | +| dat_type | varchar(23) | Database type, common library or subscription library | + ### mo_role table | Column | Type | comments | @@ -113,22 +96,6 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | created_time | timestamp | create time | | comments | text | comment | -### mo_user table - -| Column | Type | comments | -| --------------------- | ------------ | ------------------- | -| user_id | int | user id, primary key | -| user_host | varchar(100) | user host address | -| user_name | varchar(100) | user name | -| authentication_string | varchar(100) | authentication string encrypted with password | -| status | varchar(8) | open,locked,expired | -| created_time | timestamp | user created time | -| expired_time | timestamp | user expired time | -| login_type | varchar(16) | ssl/password/other | -| creator | int | the creator id who created this user | -| owner | int | the admin id for this user | -| default_role | int | the default role id for this user | - ### mo_user_grant table | Column | Type | comments | @@ -164,18 +131,6 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | granted_time | timestamp | granted time | | with_grant_option | bool | If permission granting is permitted | -### mo_stages table - -| Column | Type | comments | -| -----------------| ---------------- | ----------------- | -| stage_id | INT UNSIGNED(32) | data stage ID | -| stage_name | VARCHAR(64) | data stage name | -| url | TEXT(0) | Path to object storage (without authentication), path to file system | -| stage_credentials| TEXT(0) | Authentication information, encrypted and saved | -| stage_status | VARCHAR(64) | ENABLED/DISABLED Default: DISABLED | -| created_time | TIMESTAMP(0) | creation time | -| comment | TEXT(0) | comment | - ### mo_user_defined_function table | Column | Type | comments | @@ -223,22 +178,17 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | creator | INT UNSIGNED(32) | The ID of the user who created the release library | | comment | TEXT(0) | Remarks for creating a release library | -### mo_indexes table +### mo_stages table -| Column | Type | comments | -| -----------------| --------------- | ----------------- | -| id | BIGINT UNSIGNED(64) | index ID | -| table_id | BIGINT UNSIGNED(64) | ID of the table where the index resides | -| database_id | BIGINT UNSIGNED(64) | ID of the database where the index resides | -| name | VARCHAR(64) | name of the index | -| type | VARCHAR(11) | The type of index, including primary key index (PRIMARY), unique index (UNIQUE), secondary index (MULTIPLE) | -| is_visible | TINYINT(8) | Whether the index is visible, 1 means visible, 0 means invisible (currently all MatrixOne indexes are visible indexes) | -| hidden | TINYINT(8) | Whether the index is hidden, 1 is a hidden index, 0 is a non-hidden index| -| comment | VARCHAR(2048) | Comment information for the index | -| column_name | VARCHAR(256) | The column name of the constituent columns of the index | -| ordinal_position | INT UNSIGNED(32) | Column ordinal in index, starting from 1 | -| options | TEXT(0) | options option information for index | -| index_table_name | VARCHAR(5000) | The table name of the index table corresponding to the index, currently only the unique index contains the index table | +| Column | Type | comments | +| -----------------| ---------------- | ----------------- | +| stage_id | INT UNSIGNED(32) | data stage ID | +| stage_name | VARCHAR(64) | data stage name | +| url | TEXT(0) | Path to object storage (without authentication), path to file system | +| stage_credentials| TEXT(0) | Authentication information, encrypted and saved | +| stage_status | VARCHAR(64) | ENABLED/DISABLED Default: DISABLED | +| created_time | TIMESTAMP(0) | creation time | +| comment | TEXT(0) | comment | ### mo_sessions view @@ -263,6 +213,17 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | client_host | VARCHAR(65535) | IP address and port of the client. | | role | VARCHAR(65535) | Role name of the user. | +### `mo_configurations` table + +| Column Name | Data Type | Description | +| ------------- | --------------- | --------------------------------------- | +| node_type | VARCHAR(65535) | Type of the node: cn, tn, log, proxy. | +| node_id | VARCHAR(65535) | Unique identifier for the node. | +| name | VARCHAR(65535) | Name of the configuration setting, prefixed with nested structure if applicable. | +| current_value | VARCHAR(65535) | Current value of the configuration setting. | +| default_value | VARCHAR(65535) | Default value of the configuration setting. | +| internal | VARCHAR(65535) | Indicates whether the configuration parameter is internal. | + ### mo_locks view | Column | Type | comments | @@ -275,6 +236,87 @@ Start with MatrixOne 0.6 has introduced the concept of multi-account, the defaul | lock_status | VARCHAR(65535) | Lock status can be `wait`, `acquired`, or `none`.
`wait`: No transaction holds the lock, but transactions are waiting for it.
`acquired`: A transaction holds the lock.
`none`: No transaction holds the lock, and no transactions await it. | | waiting_txns | VARCHAR(65535) | Transactions waiting on this lock. | +### `mo_variables` view + +| Column | Type | comments | +| ------------- | --------------- | ------------------------------------------------ | +| configuration_id | INT(32) | Auto-incremented identifier for each configuration. | +| account_id | INT(32) | Unique identifier for the account (tenant). | +| account_name | VARCHAR(300) | Name of the account (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 | Type | comments | +| ------------- | --------------- | ------------------------------------------------ | +| cn_id | VARCHAR(65535) | Unique identifier for the CN (Compute Node). | +| txn_id | VARCHAR(65535) | Unique identifier for the transaction. | +| create_ts | VARCHAR(65535) | Records the transaction creation timestamp, following the RFC3339Nano format ("2006-01-02T15:04:05.999999999Z07:00"). | +| snapshot_ts | VARCHAR(65535) | Represents the snapshot timestamp of the transaction, in a format that combines physical and logical time. | +| prepared_ts | VARCHAR(65535) | Represents the prepared timestamp of the transaction, in a format that combines physical and logical time. | +| commit_ts | VARCHAR(65535) | Represents the commit timestamp of the transaction, in a format that combines physical and logical time. | +| txn_mode | VARCHAR(65535) | Indicates the transaction mode, which can be either pessimistic or optimistic. | +| isolation | VARCHAR(65535) | Represents the isolation level of the transaction, which can be SI (Snapshot Isolation) or RC (Read Committed). | +| user_txn | VARCHAR(65535) | Indicates a user transaction, i.e., a transaction created by SQL operations executed by a user connecting to MatrixOne via a client. | +| txn_status | VARCHAR(65535) | Represents the current status of the transaction, with possible values including active, committed, aborting, aborted. In distributed transaction 2PC mode, it may 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, which can be either range (range lock) or point (point lock). | +| lock_content | VARCHAR(65535) | Represents the value for a point lock or a range for a range lock, usually in the form "low - high." Please note that a transaction may involve multiple locks, but only the first lock is displayed here. | +| lock_mode | VARCHAR(65535) | Represents the lock mode, which can be either exclusive or shared. | + +### mo_columns table + +| Column | type | comments | +| --------------------- | --------------- | ------------------------------------------------------------ | +| att_uniq_name | varchar(256) | Primary Key. Hidden, composite primary key, format is like "${att_relname_id}-${attname}" | +| account_id | int unsigned | accountID | +| att_database_id | bigint unsigned | databaseID | +| att_database | varchar(256) | database Name | +| att_relname_id | bigint unsigned | table id | +| att_relname | varchar(256) | The table this column belongs to.(references mo_tables.relname) | +| attname | varchar(256) | The column name | +| atttyp | varchar(256) | The data type of this column (zero for a dropped column). | +| attnum | int | The number of the column. Ordinary columns are numbered from 1 up. | +| att_length | int | bytes count for the type. | +| attnotnull | tinyint(1) | This represents a not-null constraint. | +| atthasdef | tinyint(1) | This column has a default expression or generation expression. | +| att_default | varchar(1024) | default expression | +| attisdropped | tinyint(1) | This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL. | +| att_constraint_type | char(1) | p = primary key constraint, n=no constraint | +| att_is_unsigned | tinyint(1) | unsigned or not | +| att_is_auto_increment | tinyint(1) | auto increment or not | +| att_comment | varchar(1024) | comment | +| att_is_hidden | tinyint(1) | hidden or not | +| attr_has_update | tinyint(1) | This columns has update expression | +| attr_update | varchar(1024) | update expression | +| attr_is_clusterby | tinyint(1) | Whether this column is used as the cluster by keyword to create the table | + +### mo_tables table + +| Column | Type | comments | +| -------------- | --------------- | ------------------------------------------------------------ | +| rel_id | bigint unsigned | Primary key, table ID | +| relname | varchar(100) | Name of the table, index, view, and so on. | +| reldatabase | varchar(100) | The database that contains this relation. reference mo_database.datname | +| reldatabase_id | bigint unsigned | The database id that contains this relation. reference mo_database.datid | +| relpersistence | varchar(100) | p = permanent table, t = temporary table | +| relkind | varchar(100) | r = ordinary table, e = external table, i = index, S = sequence, v = view, m = materialized view | +| rel_comment | varchar(100) | | +| rel_createsql | varchar(100) | Table creation SQL statement | +| created_time | timestamp | Create time | +| creator | int unsigned | Creator ID | +| owner | int unsigned | Creator's default role id | +| account_id | int unsigned | Account id | +| partitioned | blob | Partition by statement | +| partition_info | blob | the information of partition | +| viewdef | blob | View definition statement | +| constraint | varchar(5000) | Table related constraints | +| rel_version | INT UNSIGNED(0) | Version number of Primary key or table | +| catalog_version | INT UNSIGNED(0) | Version number of the system table | + ## `system_metrics` database `system_metrics` collect the status and statistics of SQL statements, CPU & memory resource usage.