Skip to content

Commit

Permalink
[Doc] Add 3.3 MV-related params (#44870)
Browse files Browse the repository at this point in the history
(cherry picked from commit f0003d4)

# Conflicts:
#	docs/en/administration/management/FE_configuration.md
#	docs/en/reference/System_variable.md
#	docs/zh/reference/System_variable.md
  • Loading branch information
EsoragotoSpirit authored and mergify[bot] committed Apr 29, 2024
1 parent fbdf1e1 commit 726c030
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 46 deletions.
21 changes: 21 additions & 0 deletions docs/en/administration/management/FE_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,27 @@ ADMIN SET FRONTEND CONFIG ("key" = "value");
- Description: Whether to refresh an asynchronous materialized view immediately after creation. When this item is set to `true`, newly created materialized view will be refreshed immediately.
- Introduced in: v3.2.3

<<<<<<< HEAD
=======
##### enable_materialized_view_metrics_collect

- Default: true
- Type: Boolean
- Unit: -
- Is mutable: Yes
- Description: Whether to collect monitoring metrics for asynchronous materialized views by default.
- Introduced in: v3.1.11, v3.2.5

##### enable_materialized_view_text_based_rewrite

- Default: true
- Type: Boolean
- Unit: -
- Is mutable: Yes
- Description: Whether to enable text-based query rewrite by default. If this item is set to `true`, the system builds the abstract syntax tree while creating an asynchronous materialized view.
- Introduced in: v3.2.5

>>>>>>> f0003d4dab ([Doc] Add 3.3 MV-related params (#44870))
##### enable_mv_automatic_active_check

- Default: true
Expand Down
49 changes: 29 additions & 20 deletions docs/en/reference/System_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,68 +191,77 @@ Used for MySQL client compatibility. No practical usage.

### enable_sync_materialized_view_rewrite

* **Description**: Whether to enable synchronized materialized view rewrite or not.
* **Description**: Whether to enable query rewrite based on synchronous materialized views.
* **Default**: true
* **Introduced in**: v3.1
* **Introduced in**: v3.1.11, v3.2.5

### query_including_mv_names

* **Description**: Specifies the including mv names to be used for materialized view rewrite to reduce the related materialized view numbers and reduce the optimizer time for rewrite.
* **Description**: Specifies the name of the asynchronous materialized views to include in query execution. You can use this variable to limit the number of candidate materialized views and improve the query rewrite performance in the optimizer. This item takes effect prior to `query_excluding_mv_names`.
* **Default**: empty
* **Data type**: String
* **Introduced in**: v3.1
* **Introduced in**: v3.1.11, v3.2.5

### query_excluding_mv_names(

* **Description**: Specifies the excluding mv names to be used for materialized view rewrite to reduce the related materialized view numbers and reduce the optimizer time for rewrite.
* **Description**: Specifies the name of the asynchronous materialized views to exclude from query execution. You can use this variable to limit the number of candidate materialized views and reduce the time of query rewrite in the optimizer. `query_including_mv_names` takes effect prior to this item.
* **Default**: empty
* **Data type**: String
* **Introduced in**: v3.1
* **Introduced in**: v3.1.11, v3.2.5

### optimizer_materialized_view_timelimit

* **Description**: Specifies the maximum time that one materialized view rewrite rule costs before exhausted
* **Default**: 1000(ms)
* **Description**: Specifies the maximum time that one materialized view rewrite rule can consume. When the threshold is reached, this rule will not be used for query rewrite.
* **Default**: 1000
* **Unit**: ms
* **Introduced in**: v3.1.9, v3.2.5

### enable_materialized_view_text_match_rewrite

* **Description**: Whether to enable text based materialized view rewrite or not. If true, optimizer will compare query and created materialized views, it will be rewritten if the materialized view's define query ast tree is the same with the input query or its subquery.
* **Description**: Whether to enable text-based materialized view rewrite. When this item is set to true, the optimizer will compare the query with the existing materialized views. A query will be rewritten if the abstract syntax tree of the materialized view's definition matches that of the query or its sub-query.
* **Default**: true
* **Introduced in**: v3.2.5, v3.3.0

### materialized_view_subuqery_text_match_max_count

* **Description**: Specifies the maximum number of checking whether one query's subquery is matched with the defined materialized views.
* **Description**: Specifies the maximum number of times that the system checks whether a query's sub-query matches the materialized views' definition.
* **Default**: 4
* **Introduced in**: v3.2.5, v3.3.0

<<<<<<< HEAD
=======
### enable_force_rule_based_mv_rewrite

* **Description**: Whether to enable query rewrite for queries against multiple tables in the optimizer's rule-based optimization phase. Enabling this feature will improve the robustness of the query rewrite. However, it will also increase the time consumption if the query misses the materialized view.
* **Default**: true
* **Introduced in**: v3.3.0

>>>>>>> f0003d4dab ([Doc] Add 3.3 MV-related params (#44870))
### enable_view_based_mv_rewrite

* **Description**: Whether to enable view based rewrite or not. If true, treat logical view as unified node to rewrite rather than inlining it to be better for rewrite.
* **Description**: Whether to enable query rewrite for logical view-based materialized views. If this item is set to `true`, the logical view is used as a unified node to rewrite the queries against itself for better performance. If this item is set to `false`, the system transcribes the queries against logical views into queries against physical tables or materialized views and then rewrites them.
* **Default**: false
* **Introduced in**: v3.1.9, v3.2.5
* **Introduced in**: v3.1.9, v3.2.5, v3.3.0

### enable_materialized_view_union_rewrite

* **Description**: Whether to enable materialized view union rewrite or not. If true, try to use union all compensate when materialized view predicates cannot satisfy the query's predicates.
* **Description**: Whether to enable materialized view union rewrite. If this item is set to `true`, the system seeks to compensate the predicates using UNION ALL when the predicates in the materialized view cannot satisfy the query's predicates.
* **Default**: true
* **Introduced in**: v2.5
* **Introduced in**: v2.5.20, v3.1.9, v3.2.7, v3.3.0

### follower_query_forward_mode

* **Description**: Flag to control whether to proxy follower's query statement to leader/follower.
* **Description**: Specifies to which FE nodes the query statements are routed.

Valid values:
* Valid values:

* `default`: proxy the query statement to leader/follower decided by the follower's replay progress.
* `leader`: proxy the query statement to leader fe.
* `follower`: not proxy the query statement to leader fe.
* `default`: Routes the query statement to the Leader FE or Follower FEs, depending on the Follower's replay progress. If the Follower FE nodes have not completed replay progress, queries will be routed to the Leader FE node. If the replay progress is complete, queries will be preferentially routed to the Follower FE node.
* `leader`: Routes the query statement to the Leader FE.
* `follower`: Routes the query statement to Follower FE.

* **Default**: default
* **Data type**: String
* **Introduced in**: v2.5
* **Introduced in**: v2.5.20, v3.1.9, v3.2.7, v3.3.0

### character_set_database (global)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ Properties of the asynchronous materialized view. You can modify the properties
- `false` (Default value): Disable query rewrite for external catalog-based materialized views.

Because strong data consistency is not guaranteed between base tables and external catalog-based materialized views, this feature is set to `false` by default. When this feature is enabled, the materialized view is used for query rewrite in accordance with the rule specified in `query_rewrite_consistency`.
- `enable_query_rewrite`: Whether to use the materialized view for query rewrite. When there are many materialized views, query rewrite based on materialized views can impact the optimizer's time consumption. With this property, you can control whether the materialized view can be used for query rewrite. This feature is supported from v3.3.0 onwards. Valid values:
- `default` (Default): The system will not perform semantic checks on the materialized view, but only the SPJG-type materialized views can be used for query rewrite. Note that if the text-based query rewrite is enabled, non-SPJG-type materialized views can also be used for query rewrite.
- `true`: The system will perform semantic checks when creating or modifying the materialized view. If the materialized view is not eligible for query rewrite (that is, the definition of the materialized view is not an SPJG-type query), a failure will be returned.
- `false`: The materialized view will not be used for query rewrite.

> **CAUTION**
>
Expand Down
18 changes: 18 additions & 0 deletions docs/zh/administration/management/FE_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,24 @@ ADMIN SET FRONTEND CONFIG ("key" = "value");
- 描述:创建异步物化视图后,是否立即刷新该物化视图。当设置为 `true` 时,异步物化视图创建后会立即刷新。
- 引入版本:v3.2.3

##### enable_materialized_view_metrics_collect

- 默认值:true
- 类型:Boolean
- 单位:-
- 是否动态:是
- 描述:是否默认收集异步物化视图的监控指标。
- 引入版本:v3.1.11,v3.2.5

##### enable_materialized_view_text_based_rewrite

- 默认值:true
- 类型:Boolean
- 单位:-
- 是否动态:是
- 描述:是否默认启用基于文本的查询改写。如果此项设置为 `true`,则系统在创建异步物化视图时构建抽象语法树。
- 引入版本:v3.2.5

##### enable_mv_automatic_active_check

- 默认值:true
Expand Down
56 changes: 33 additions & 23 deletions docs/zh/reference/System_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,65 +190,75 @@ SELECT /*+ SET_VAR

### enable_sync_materialized_view_rewrite

* 描述:是否启用同步物化视图自动改写
* 描述:是否启用基于同步物化视图的查询改写
* 默认值:true
* 引入版本:v3.1
* 引入版本:v3.1.11,v3.2.5

### query_including_mv_names

* 描述:指定用于物化视图自动改写包含的物化视图名称,以减少相关物化视图数量,并减少优化器用于重写的时间
* 默认值:empty string
* 描述:指定需要在查询执行过程中包含的异步物化视图的名称。您可以使用此变量来限制候选物化视图的数量,并提高优化器中的查询改写性能。此项优先于 `query_excluding_mv_names` 生效
* 默认值:空字符串
* 类型:String
* 引入版本:v3.1
* 引入版本:v3.1.11,v3.2.5

### query_excluding_mv_names

* 描述:指定用于物化视图自动改写排除的物化视图名称,以减少相关物化视图数量,并减少优化器用于重写的时间
* 默认值:empty string
* 描述:指定需要在查询执行过程中排除的异步物化视图的名称。您可以使用此变量来限制候选物化视图的数量,并提高优化器中的查询改写性能。`query_including_mv_names` 优先于此项生效
* 默认值:空字符串
* 类型:String
* 引入版本:v3.1
* 引入版本:v3.1.11,v3.2.5

### optimizer_materialized_view_timelimit

* 描述:在一个 Query改写中,指定一个物化视图自动改写规则最大耗时时间,超过该时间后,不会再使用改规则进行自动改写
* 默认值:1000 (ms)
* 描述:指定一个物化视图改写规则可消耗的最大时间。当达到阈值时,将不再使用该规则进行查询改写
* 默认值:1000
* 单位:毫秒
* 类型:Long

### enable_materialized_view_text_match_rewrite

* 描述:是否启用基于文本的物化视图重写。如果设置为true,则优化器将比较查询和创建的物化视图,如果物化视图的定义查询AST树与输入查询或其子查询相同,则将进行重写
* 描述:是否启用基于文本的物化视图改写。当此项设置为 `true` 时,优化器将查询与现有的物化视图进行比较。如果物化视图定义的抽象语法树与查询或其子查询的抽象语法树匹配,则会对查询进行改写
* 默认值:true
* 引入版本:v3.2.5, v3.3.0
* 引入版本:v3.2.5v3.3.0

### materialized_view_subuqery_text_match_max_count

* 描述:指定检查一个查询中,递归匹配子查询与定义的物化视图匹配的最大次数
* 描述:指定系统比对查询的子查询是否与物化视图定义匹配的最大次数
* 默认值:4
* 引入版本:v3.2.5, v3.3.0
* 引入版本:v3.2.5,v3.3.0

<<<<<<< HEAD
=======
### enable_force_rule_based_mv_rewrite

* 描述:在优化器的 RBO(rule-based optimization)阶段是否针对多表查询启用查询改写。启用此功能将提高查询改写的鲁棒性。但如果查询未命中物化视图,则会增加优化耗时。
* 默认值:true
* 引入版本:v3.3

>>>>>>> f0003d4dab ([Doc] Add 3.3 MV-related params (#44870))
### enable_view_based_mv_rewrite

* 描述:是否启用基于视图的重写。如果设置为true,则将逻辑视图视为统一节点进行重写,而不是内联它,以便更好地进行重写
* 描述:是否为基于逻辑视图创建的物化视图启用查询改写。如果此项设置为 `true`,则逻辑视图被用作统一节点进行查询改写,从而获得更好的性能。如果此项设置为 `false`,则系统将针对逻辑视图的查询展开变为针对物理表或物化视图的查询,然后进行改写
* 默认值:false
* 引入版本:v3.1.9, v3.2.5
* 引入版本:v3.1.9v3.2.5,v3.3.0

### enable_materialized_view_union_rewrite

* 描述:是否启用物化视图 Union Rewrite: 如果设置为true,则在物化视图的谓词不能满足查询的谓词时,尝试使用 UNION ALL 进行补偿
* 描述:是否启用物化视图 UNION 改写。如果此项设置为 true,则系统在物化视图的谓词不能满足查询的谓词时,会尝试使用 UNION ALL 来补偿谓词
* 默认值:true
* 引入版本:v2.5
* 引入版本:v2.5.20,v3.1.9,v3.2.7,v3.3.0

### follower_query_forward_mode

* 描述:用于控制将查询路由到 FE Leader/Follower的标志。
* 描述:用于指定将查询语句路由到 Leader FE 或 Follower FE 节点。

有效值:
* `default`: 将查询语句路由到 Leader/Follower,由 Follower 的回放进度决定
* `leader`: 将查询语句路由到 Leader。
* `follower`: 将查询语句路由到 Follower。
* `default`: 将查询语句路由到 Leader FE 或 Follower FE 节点,取决于 Follower FE 节点的回放进度。如果 Follower FE 节点未完成回放,查询将会被路由至 Leader FE 节点。反之,查询会被优先路由至 Follower FE 节点
* `leader`: 将查询语句路由到 Leader FE 节点
* `follower`: 将查询语句路由到 Follower FE 节点
* 默认值:default
* 类型:String
* 引入版本:v2.5
* 引入版本:v2.5.20,v3.1.9,v3.2.7,v3.3.0

### character_set_database(global)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ AS
- `false`(默认值):禁用基于 External Catalog 的物化视图的查询改写。

由于无法保证基表和基于 External Catalog 的物化视图之间的数据强一致,因此默认情况下禁用此功能。启用此功能时,物化视图将根据 `query_rewrite_consistency` 中指定的规则改写查询。
- `enable_query_rewrite`:是否使用物化视图进行查询改写。当存在大量物化视图时,基于物化视图的查询改写可能会影响优化器的耗时。通过此属性,您可以控制是否允许使用物化视图进行查询改写。该功能自 v3.3.0 起支持。有效值:
- `default`(默认):系统将不会针对物化视图执行语义检查,但只有 SPJG 类型的物化视图可以用于查询改写。请注意,如果启用了基于文本的查询改写,非 SPJG 类型的物化视图也可以用于查询改写。
- `true`:系统将在创建或修改物化视图时执行语义检查。如果物化视图不符合查询改写的条件(即,物化视图的定义不是 SPJG 类型的查询),则会返回失败信息。
- `false`:物化视图将不会用于查询改写。

> **注意**
>
> Unique Key 约束和外键约束仅用于查询改写。导入数据时,不保证进行外键约束校验。您必须确保导入的数据满足约束条件。
> **注意**
>
> Unique Key 约束和外键约束仅用于查询改写。导入数据时,不保证进行外键约束校验。您必须确保导入的数据满足约束条件。
**query_statement**(必填)

Expand Down

0 comments on commit 726c030

Please sign in to comment.