
# 系统表和系统视图
表1GaussDB数据库与MySQL的系统表或系统视图差异 
| 序号 | 系统表或系统视图                      | 差异列                           | M-Compatibility与MySQL的差异                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| 1  | information_schema.columns    | generation_expression         | 该字段输出结果因涉及M-Compatibility与MySQL的表达式的字符串拼接逻辑的不同而存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 2  | information_schema.columns    | data_type                     | 该字段输出结果因涉及M-Compatibility的数据类型format_type输出，目前未修改，与MySQL存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 3  | information_schema.columns    | column_type                   | 该字段输出结果因涉及M-Compatibility的数据类型format_type输出，目前未修改，与MySQL存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 4  | information_schema.tables     | engine                        | M-Compatibility中： - ENGINE对齐information_schema.engines数据。   - 部分系统表ENGINE为空。                                                                                                                                                                                                                 |
| 5  | information_schema.tables     | version                       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 6  | information_schema.tables     | row_format                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 7  | information_schema.tables     | avg_row_length                | M-Compatibility下表示使用数据文件除以所有元组数（包括活元组和死元组）的结果。表中没有元组，值为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 8  | information_schema.tables     | max_data_length               | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 9  | information_schema.tables     | data_free                     | M-Compatibility中表示死元组在总元组中的比例乘以数据文件大小。如果表中没有元组，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 10 | information_schema.tables     | check_time                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 11 | information_schema.tables     | create_time                   | 在M-Compatibility下，此字段与MySQL行为表现有差异，对于创建视图的情形MySQL中该字段置null，M-Compatibility则显示实际的创建表时间。数据库自带的表，视图设置null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 12 | information_schema.tables     | update_time                   | M-Compatibility数据库自带的表，视图设置null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 13 | information_schema.tables     | table_collation               | 在M-Compatibility下，此字段与MySQL行为表现有差异。如果表指定的是视图，则为null。如果指定的表在创建时，未使用COLLATE子句指定列的排序规则，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 14 | information_schema.statistics | collation                     | M-Compatibility只有值A、D，不会是NULL。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 15 | information_schema.statistics | packed                        | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 16 | information_schema.statistics | sub_part                      | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 17 | information_schema.statistics | comment                       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 18 | information_schema.partitions | subpartition_name             | M-Compatibility中，如果分区不是子分区，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 19 | information_schema.partitions | subpartition_ordinal_position | M-Compatibility中，如果分区不是子分区，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 20 | information_schema.partitions | partition_method              | M-Compatibility中， 分区策略。如果分区不是一级分区，则为null。 - 'r'：范围分区。  - 'i'：间隔分区。  - 'l'：list分区。  - 'h'：hash分区。         |
| 21 | information_schema.partitions | subpartition_method           | M-Compatibility中， 子分区策略。如果分区不是二级分区，则为null。 - 'r'：范围分区。  - 'i'：间隔分区。  - 'l'：list分区。  - 'h'：hash分区。   |
| 22 | information_schema.partitions | partition_description         | M-Compatibility中，是区分一级分区和二级分区的。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 23 | information_schema.partitions | partition_expression          | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 24 | information_schema.partitions | subpartition_expression       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 25 | information_schema.partitions | data_length                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 26 | information_schema.partitions | max_data_length               | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 27 | information_schema.partitions | index_length                  | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 28 | information_schema.partitions | data_free                     | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 29 | information_schema.partitions | create_time                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 30 | information_schema.partitions | update_time                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 31 | information_schema.partitions | check_time                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 32 | information_schema.partitions | checksum                      | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 33 | information_schema.partitions | partition_comment             | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 34 | information_schema.partitions | nodegroup                     | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   
![](https://support.huaweicloud.com/usermanual-ugo/public_sys-resources/note_3.0-zh-cn.png)
- 视图中对于整型的类型回显，不支持指定精度范围。如MySQL的bigint(1)，M-Compatibility下对应的是bigint类型，MySQL中bigint(21) unsigned，在M-Compatibility下对应的是bigint unsigned类型。
- MySQL中int类型，在M-Compatibility中是integer类型。
- MySQL中的set、enum类型的字段，M-Compatibility中都不支持。m_schema.columns_priv视图的Column_priv字段、m_schema.tables_priv视图的Table_priv,Column_priv字段、m_schema.procs_priv视图的Routine_type,Proc_priv字段、m_schema.proc视图的type,language,sql_data_access,is_deterministic,security_type,sql_mode字段、m_schema.func视图的type字段均不支持，在此版本中不予显示。
- 由于information_schema.tables、information_schema.statistics中table_rows、avg_row_length、data_length、data_free、index_length、cardinality基于统计信息获取，查看前请先执行ANALYZE，更新统计信息后再查看（如果数据库中更新数据，建议延迟执行ANALYZE）。
- information_schema.statistics包含的索引列需要是创建索引中索引列是完整的表列，如果索引列是表达式，不在这个视图中。
- information_schema.partitions 中table_row, avg_row_length基于统计信息获取，查看前请先执行ANALYZE，更新统计信息后再查看（如果数据库中更新数据，建议延迟执行ANALYZE）。
- information_schema.partitions中一级分区和二级分区是分开呈现。
- 对于支持的grantee字段，MySQL的格式是'*user_name* '@'*host_name*' ，在M-Compatibility数据库，是被授予权限的用户或角色的名称。
- 对于支持的host字段，在M-Compatibility数据库，返回当前节点的hostname。
- m_schema.tables_priv、information_schema.user_privileges、information_schema.schema_privileges，information_schema.table_privileges、information_schema.column_privileges、m_schema.columns_priv、m_schema.func、m_schema.procs_priv 在MySQL下需要授权后才能查看视图内容，M-Compatibility数据库可以根据默认权限查看到对应的内容。如对于表t1，在MySQL下需要先对t1给对应的用户授权，才能在权限视图中看到对应的权限信息，M-Compatibility数据库下则可以直接在视图中看到t1表相关的权限信息。
- m_schema中的系统视图，但在MySQL是系统表。
- information_schema.views中的VIEW_DEFINITION以及information_schema.routines中的ROUTINE_DEFINITION不做字符序控制。
 
