
# 系统表和系统视图
表1M-Compatibility与GaussDB的系统表或系统视图的差异 
| 系统表或系统视图                      | 差异列                           | M-Compatibility与MySQL的差异                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| information_schema.columns    | generation_expression         | 该字段输出结果因涉及M-Compatibility与MySQL的表达式的字符串拼接逻辑的不同而存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| information_schema.columns    | data_type                     | 该字段输出结果因涉及M-Compatibility的数据类型format_type输出，目前未修改，与MySQL存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| information_schema.columns    | column_type                   | 该字段输出结果因涉及M-Compatibility的数据类型format_type输出，目前未修改，与MySQL存在差异。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| information_schema.tables     | engine                        | M-Compatibility中： - ENGINE对齐information_schema.engines数据。  - 部分系统表ENGINE为空。  - 在默认为ASTORE表且未指定STORAGE_TYPE时ENGINE为空。                                                                                                                                                                                                                                           |
| information_schema.tables     | version                       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.tables     | row_format                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.tables     | avg_row_length                | M-Compatibility下表示使用数据文件除以所有元组数（包括活元组和死元组）的结果。表中没有元组，值为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| information_schema.tables     | max_data_length               | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.tables     | data_free                     | M-Compatibility中表示死元组在总元组中的比例乘以数据文件大小。如果表中没有元组，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| information_schema.tables     | check_time                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.tables     | create_time                   | 在M-Compatibility下，此字段与MySQL行为表现有差异，对于创建视图的情形MySQL中该字段置null，M-Compatibility则显示实际的创建表时间。数据库自带的表，视图设置null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.tables     | update_time                   | M-Compatibility数据库自带的表，视图设置null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| information_schema.statistics | collation                     | M-Compatibility只有值A、D，不会是NULL。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| information_schema.statistics | packed                        | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.statistics | sub_part                      | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.statistics | comment                       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | subpartition_name             | M-Compatibility中，如果分区不是子分区，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| information_schema.partitions | subpartition_ordinal_position | M-Compatibility中，如果分区不是子分区，则为null。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| information_schema.partitions | partition_method              | M-Compatibility中， 分区策略。如果分区不是一级分区，则为null。 - 'r'：范围分区。  - 'i'：间隔分区。  - 'l'：list分区。  - 'h'：hash分区。          |
| information_schema.partitions | subpartition_method           | M-Compatibility中， 子分区策略。如果分区不是二级分区，则为null。 - 'r'：范围分区。  - 'i'：间隔分区。  - 'l'：list分区。  - 'h'：hash分区。   |
| information_schema.partitions | partition_description         | M-Compatibility中，是区分一级分区和二级分区的。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| information_schema.partitions | partition_expression          | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | subpartition_expression       | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | data_length                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | max_data_length               | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | index_length                  | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | data_free                     | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | create_time                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | update_time                   | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | check_time                    | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | checksum                      | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | partition_comment             | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| information_schema.partitions | nodegroup                     | M-Compatibility中不支持该字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   
![](https://support.huaweicloud.com/distributed-compatibility-v8-gaussdb/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中table_rows、avg_row_length、data_length、data_free、index_length及information_schema.statistics中cardinality基于统计信息获取，查看前请先执行ANALYZE，更新统计信息后再查看（如果数据库中更新数据，建议延迟执行ANALYZE）。
- information_schema.statistics包含的索引列需要是创建索引中索引列是完整的表列，如果索引列是表达式，不在这个视图中。
- information_schema.partitions 中table_row基于统计信息获取，查看前请先执行ANALYZE，更新统计信息后再查看（如果数据库中更新数据，建议延迟执行ANALYZE）。
- 对于支持的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不做字符序控制。
- 《M-Compatibility开发指南》中"Schema"章节所列举的字符类型的视图字段，字符集使用utf8mb4，字符序使用utf8mb4_bin或utf8mb4_general_ci，字符序优先级为《M-Compatibility开发指南》中"SQL参考 \> 字符集与字符序 \> 字符集和字符序合并规则"所描述的"支持字符序的数据类型的列"的优先级，和MySQL存在差异。
 
