You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2023/01/20 10:29:27 UTC

[GitHub] [flink] LadyForest opened a new pull request, #21739: [FLINK-30673][docs][table] Add documentation for "EXPLAIN PLAN_ADVICE" statement

LadyForest opened a new pull request, #21739:
URL: https://github.com/apache/flink/pull/21739

   ## What is the purpose of the change
   
   This pull request adds documentation for `EXPLAIN PLAN_ADVICE` statement.
   
   
   ## Brief change log
   
   Add doc.
   
   
   ## Verifying this change
   
   This change is already covered by existing tests.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): No
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: No
     - The serializers: No
     - The runtime per-record code paths (performance sensitive): No
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: No
     - The S3 file system connector: No
   
   ## Documentation
   
     - Does this pull request introduces a new feature? Yes
     - If yes, how is the feature documented? docs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #21739: [FLINK-30673][docs][table] Add documentation for "EXPLAIN PLAN_ADVICE" statement

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #21739:
URL: https://github.com/apache/flink/pull/21739#issuecomment-1398198832

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e19d7dc89412bb6cd9bcf781a8938e9023e23048",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "e19d7dc89412bb6cd9bcf781a8938e9023e23048",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e19d7dc89412bb6cd9bcf781a8938e9023e23048 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] lincoln-lil merged pull request #21739: [FLINK-30673][docs][table] Add documentation for "EXPLAIN PLAN_ADVICE" statement

Posted by "lincoln-lil (via GitHub)" <gi...@apache.org>.
lincoln-lil merged PR #21739:
URL: https://github.com/apache/flink/pull/21739


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] lincoln-lil commented on a diff in pull request #21739: [FLINK-30673][docs][table] Add documentation for "EXPLAIN PLAN_ADVICE" statement

Posted by "lincoln-lil (via GitHub)" <gi...@apache.org>.
lincoln-lil commented on code in PR #21739:
URL: https://github.com/apache/flink/pull/21739#discussion_r1095333436


##########
docs/content.zh/docs/dev/table/sql/explain.md:
##########
@@ -274,19 +331,190 @@ Union(all=[true], union=[count, word])
 <a name="explaindetails"></a>
 
 ## ExplainDetails
+使用指定的 `ExplainDetail` 类型来打印语句的计划。
+
+**ESTIMATED_COST**
+
+指定 `ESTIMATED_COST` 将使得优化器(optimizer)将估算出的成本信息附加在每个物理节点上输出。
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+指定 `CHANGELOG_MODE` 将使得优化器(optimizer)将 changelog mode 附加在每个物理节点上输出。
+关于 changelog mode 更多信息请参阅 [动态表]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)。
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+指定 `PLAN_ADVICE` 将使得优化器(optimizer)分析优化后的物理执行计划并提供潜在的数据风险预警或性能调优建议。
+此时输出标题将会从 “Optimized Physical Plan” 变为 “Optimized Physical Plan with Advice” 作为提示。
+
+针对物理计划的建议按照 **类型** 和 **范围** 来区分。
+
+| 建议类型    | 说明             |
+|:--------|:---------------|
+| WARNING | 给出潜在的数据正确性风险   |
+| ADVICE  | 给出可能的 SQL 调优建议 |
+
+
+| 建议范围        | 说明           |
+|:------------|:-------------|
+| QUERY_LEVEL | 针对整个 SQL 的建议 |
+| NODE_LEVEL  | 针对单个物理节点的建议  |
+
+目前 Flink SQL 提供针对如下问题的建议

Review Comment:
   -> '从 Flink-1.17 开始提供以下问题的分析建议' ?



##########
docs/content.zh/docs/dev/table/sql/explain.md:
##########
@@ -274,19 +331,190 @@ Union(all=[true], union=[count, word])
 <a name="explaindetails"></a>
 
 ## ExplainDetails
+使用指定的 `ExplainDetail` 类型来打印语句的计划。
+
+**ESTIMATED_COST**
+
+指定 `ESTIMATED_COST` 将使得优化器(optimizer)将估算出的成本信息附加在每个物理节点上输出。
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+指定 `CHANGELOG_MODE` 将使得优化器(optimizer)将 changelog mode 附加在每个物理节点上输出。
+关于 changelog mode 更多信息请参阅 [动态表]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)。
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+指定 `PLAN_ADVICE` 将使得优化器(optimizer)分析优化后的物理执行计划并提供潜在的数据风险预警或性能调优建议。
+此时输出标题将会从 “Optimized Physical Plan” 变为 “Optimized Physical Plan with Advice” 作为提示。
+
+针对物理计划的建议按照 **类型** 和 **范围** 来区分。
+
+| 建议类型    | 说明             |
+|:--------|:---------------|
+| WARNING | 给出潜在的数据正确性风险   |
+| ADVICE  | 给出可能的 SQL 调优建议 |
+
+
+| 建议范围        | 说明           |
+|:------------|:-------------|
+| QUERY_LEVEL | 针对整个 SQL 的建议 |
+| NODE_LEVEL  | 针对单个物理节点的建议  |
+
+目前 Flink SQL 提供针对如下问题的建议
+- 数据倾斜(更多信息请参阅 [性能调优]({{< ref "docs/dev/table/tuning" >}}#local-global-aggregation))
+- 非确定性更新(*abbr.* NDU,更多信息请参阅 [流上的确定性]({{< ref "docs/dev/table/concepts/determinism" >}}#3-determinism-in-streaming-processing))
+
 
+若检测到 `GroupAggregate` 可以启用两阶段优化,优化器(optimizer)将会把建议 id 附在 `GroupAggregate` 节点内作为索引,在最后附上建议内容。
+{{< tabs "Data Skewness" >}}
+
+{{< tab "SQL1" >}}
+```sql
+SET 'table.exec.mini-batch.enabled' = 'true';
+SET 'table.exec.mini-batch.allow-latency' = '5s';
+SET 'table.exec.mini-batch.size' = '200';
+SET 'table.optimizer.agg-phase-strategy' = 'OHE_PHASE';
+
+CREATE TABLE MyTable (
+  a BIGINT,
+  b INT NOT NULL,
+  c VARCHAR,
+  d BIGINT
+) WITH (
+  'connector' = 'values',
+  'bounded' = 'false');
+
+EXPLAIN PLAN_ADVICE
+SELECT
+  AVG(a) AS avg_a,
+  COUNT(*) AS cnt,
+  COUNT(b) AS cnt_b,
+  MIN(b) AS min_b,
+  MAX(c) FILTER (WHERE a > 1) AS max_c
+FROM MyTable;
+```
+{{< /tab>}}
+
+{{< tab "NODE_LEVEL ADVICE" >}}
 ```text
-使用指定的 explainDetail 类型来打印语句的计划。
+== Optimized Physical Plan With Advice ==
+Calc(select=[avg_a, cnt, cnt AS cnt_b, min_b, max_c])
++- GroupAggregate(advice=[1], select=[AVG(a) AS avg_a, COUNT(*) AS cnt, MIN(b) AS min_b, MAX(c) FILTER $f3 AS max_c])
+   +- Exchange(distribution=[single])
+      +- Calc(select=[a, b, c, IS TRUE(>(a, 1)) AS $f3])
+         +- MiniBatchAssigner(interval=[10000ms], mode=[ProcTime])
+            +- TableSourceScan(table=[[default_catalog, default_database, MyTable, project=[a, b, c], metadata=[]]], fields=[a, b, c])
+
+advice[1]: [ADVICE] You might want to enable local-global two-phase optimization by configuring ('table.optimizer.agg-phase-strategy' to 'AUTO').
+```
+{{< /tab>}}
+
+{{< /tabs>}}
 
-ESTIMATED_COST:生成优化器(optimizer)估算的物理节点相关的成本信息, 
-例如:TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
 
-CHANGELOG_MODE:为每个物理 RelNode 生成 changelog mode。
-例如:GroupAggregate(..., changelogMode=[I,UA,D])
+若检测到 NDU 问题,优化器(optimizer)将会把建议内容附在最后。

Review Comment:
   -> '若检测到存在 NDU 问题风险时,优化器(optimizer)会把建议内容附在最后'



##########
docs/content/docs/dev/table/sql/explain.md:
##########
@@ -269,18 +326,190 @@ Union(all=[true], union=[count, word])
 {{< top >}}
 
 ## ExplainDetails
+`ExplainDetail` defines the types of details for explain result.
+
+**ESTIMATED_COST**
+
+Specify `ESTIMATED_COST` will inform the optimizer to attach the estimated optimal cost of each physical rel node to the output.
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+Specify `CHANGELOG_MODE` will inform the optimizer to attach the changelog mode (see more details at [Dynamic Tables]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)) of each physical rel node to the ouptput.
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+Specify `PLAN_ADVICE` will inform the optimizer to analyze the optimized physical plan to provide the potential risk warnings and optimization advice.

Review Comment:
   -> "risk warnings and/or optimization advice" ?



##########
docs/content.zh/docs/dev/table/sql/explain.md:
##########
@@ -274,19 +331,190 @@ Union(all=[true], union=[count, word])
 <a name="explaindetails"></a>
 
 ## ExplainDetails
+使用指定的 `ExplainDetail` 类型来打印语句的计划。
+
+**ESTIMATED_COST**
+
+指定 `ESTIMATED_COST` 将使得优化器(optimizer)将估算出的成本信息附加在每个物理节点上输出。
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+指定 `CHANGELOG_MODE` 将使得优化器(optimizer)将 changelog mode 附加在每个物理节点上输出。
+关于 changelog mode 更多信息请参阅 [动态表]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)。
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+指定 `PLAN_ADVICE` 将使得优化器(optimizer)分析优化后的物理执行计划并提供潜在的数据风险预警或性能调优建议。
+此时输出标题将会从 “Optimized Physical Plan” 变为 “Optimized Physical Plan with Advice” 作为提示。
+
+针对物理计划的建议按照 **类型** 和 **范围** 来区分。
+
+| 建议类型    | 说明             |
+|:--------|:---------------|
+| WARNING | 给出潜在的数据正确性风险   |
+| ADVICE  | 给出可能的 SQL 调优建议 |
+
+
+| 建议范围        | 说明           |
+|:------------|:-------------|
+| QUERY_LEVEL | 针对整个 SQL 的建议 |
+| NODE_LEVEL  | 针对单个物理节点的建议  |
+
+目前 Flink SQL 提供针对如下问题的建议
+- 数据倾斜(更多信息请参阅 [性能调优]({{< ref "docs/dev/table/tuning" >}}#local-global-aggregation))
+- 非确定性更新(*abbr.* NDU,更多信息请参阅 [流上的确定性]({{< ref "docs/dev/table/concepts/determinism" >}}#3-determinism-in-streaming-processing))
+
 
+若检测到 `GroupAggregate` 可以启用两阶段优化,优化器(optimizer)将会把建议 id 附在 `GroupAggregate` 节点内作为索引,在最后附上建议内容。
+{{< tabs "Data Skewness" >}}
+
+{{< tab "SQL1" >}}
+```sql
+SET 'table.exec.mini-batch.enabled' = 'true';
+SET 'table.exec.mini-batch.allow-latency' = '5s';
+SET 'table.exec.mini-batch.size' = '200';
+SET 'table.optimizer.agg-phase-strategy' = 'OHE_PHASE';
+
+CREATE TABLE MyTable (
+  a BIGINT,
+  b INT NOT NULL,
+  c VARCHAR,
+  d BIGINT
+) WITH (
+  'connector' = 'values',
+  'bounded' = 'false');
+
+EXPLAIN PLAN_ADVICE
+SELECT
+  AVG(a) AS avg_a,
+  COUNT(*) AS cnt,
+  COUNT(b) AS cnt_b,
+  MIN(b) AS min_b,
+  MAX(c) FILTER (WHERE a > 1) AS max_c
+FROM MyTable;
+```
+{{< /tab>}}
+
+{{< tab "NODE_LEVEL ADVICE" >}}
 ```text
-使用指定的 explainDetail 类型来打印语句的计划。
+== Optimized Physical Plan With Advice ==
+Calc(select=[avg_a, cnt, cnt AS cnt_b, min_b, max_c])
++- GroupAggregate(advice=[1], select=[AVG(a) AS avg_a, COUNT(*) AS cnt, MIN(b) AS min_b, MAX(c) FILTER $f3 AS max_c])
+   +- Exchange(distribution=[single])
+      +- Calc(select=[a, b, c, IS TRUE(>(a, 1)) AS $f3])
+         +- MiniBatchAssigner(interval=[10000ms], mode=[ProcTime])
+            +- TableSourceScan(table=[[default_catalog, default_database, MyTable, project=[a, b, c], metadata=[]]], fields=[a, b, c])
+
+advice[1]: [ADVICE] You might want to enable local-global two-phase optimization by configuring ('table.optimizer.agg-phase-strategy' to 'AUTO').
+```
+{{< /tab>}}
+
+{{< /tabs>}}
 
-ESTIMATED_COST:生成优化器(optimizer)估算的物理节点相关的成本信息, 
-例如:TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
 
-CHANGELOG_MODE:为每个物理 RelNode 生成 changelog mode。
-例如:GroupAggregate(..., changelogMode=[I,UA,D])
+若检测到 NDU 问题,优化器(optimizer)将会把建议内容附在最后。
+{{< tabs "Non-deterministic Updates" >}}
 
-JSON_EXECUTION_PLAN:生成 json 格式的程序执行计划。
+{{< tab "SQL2" >}}
+```sql
+CREATE TABLE MyTable (
+  a INT,
+  b BIGINT,
+  c STRING,
+  d INT,
+  `day` AS DATE_FORMAT(CURRENT_TIMESTAMP, 'yyMMdd'),
+  PRIMARY KEY (a, c) NOT ENFORCED
+) WITH (
+  'connector' = 'values',
+  'changelog-mode' = 'I,UA,UB,D'  
+);
+
+CREATE TABLE MySink (
+ a INT,
+ b BIGINT,
+ c STRING,
+ PRIMARY KEY (a) NOT ENFORCED
+) WITH (
+ 'connector' = 'values',
+ 'sink-insert-only' = 'false'
+);
+
+EXPLAIN PLAN_ADVICE
+INSERT INTO MySink
+SELECT a, b, `day`
+FROM MyTable
+WHERE b > 100;
 ```
 
+{{< /tab>}}
+
+{{< tab "QUERY_LEVEL WARNING" >}}
+```text
+== Optimized Physical Plan With Advice ==
+Sink(table=[default_catalog.default_database.MySink], fields=[a, b, day], upsertMaterialize=[true])
++- Calc(select=[a, b, DATE_FORMAT(CURRENT_TIMESTAMP(), 'yyMMdd') AS day], where=[>(b, 100)])
+   +- TableSourceScan(table=[[default_catalog, default_database, MyTable, filter=[], project=[a, b], metadata=[]]], fields=[a, b])
+
+advice[1]: [WARNING] The column(s): day(generated by non-deterministic function: CURRENT_TIMESTAMP ) can not satisfy the determinism requirement for correctly processing update message('UB'/'UA'/'D' in changelogMode, not 'I' only), this usually happens when input node has no upsertKey(upsertKeys=[{}]) or current node outputs non-deterministic update messages. Please consider removing these non-deterministic columns or making them deterministic by using deterministic functions.
+
+related rel plan:
+Calc(select=[a, b, DATE_FORMAT(CURRENT_TIMESTAMP(), _UTF-16LE'yyMMdd') AS day], where=[>(b, 100)], changelogMode=[I,UB,UA,D])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable, filter=[], project=[a, b], metadata=[]]], fields=[a, b], changelogMode=[I,UB,UA,D])
+```
+{{< /tab>}}
+
+{{< /tabs>}}
+
+
+若未检测到问题检测到问题,优化器(optimizer)将会在计划最后附上 “No available advice” 作为提示。

Review Comment:
   '若未检测到问题检测到问题' -> '若未检测到问题'



##########
docs/content.zh/docs/dev/table/sql/explain.md:
##########
@@ -274,19 +331,190 @@ Union(all=[true], union=[count, word])
 <a name="explaindetails"></a>
 
 ## ExplainDetails
+使用指定的 `ExplainDetail` 类型来打印语句的计划。
+
+**ESTIMATED_COST**
+
+指定 `ESTIMATED_COST` 将使得优化器(optimizer)将估算出的成本信息附加在每个物理节点上输出。
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+指定 `CHANGELOG_MODE` 将使得优化器(optimizer)将 changelog mode 附加在每个物理节点上输出。
+关于 changelog mode 更多信息请参阅 [动态表]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)。
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+指定 `PLAN_ADVICE` 将使得优化器(optimizer)分析优化后的物理执行计划并提供潜在的数据风险预警或性能调优建议。
+此时输出标题将会从 “Optimized Physical Plan” 变为 “Optimized Physical Plan with Advice” 作为提示。
+
+针对物理计划的建议按照 **类型** 和 **范围** 来区分。
+
+| 建议类型    | 说明             |
+|:--------|:---------------|
+| WARNING | 给出潜在的数据正确性风险   |
+| ADVICE  | 给出可能的 SQL 调优建议 |
+
+
+| 建议范围        | 说明           |
+|:------------|:-------------|
+| QUERY_LEVEL | 针对整个 SQL 的建议 |
+| NODE_LEVEL  | 针对单个物理节点的建议  |
+
+目前 Flink SQL 提供针对如下问题的建议
+- 数据倾斜(更多信息请参阅 [性能调优]({{< ref "docs/dev/table/tuning" >}}#local-global-aggregation))
+- 非确定性更新(*abbr.* NDU,更多信息请参阅 [流上的确定性]({{< ref "docs/dev/table/concepts/determinism" >}}#3-determinism-in-streaming-processing))
+
 
+若检测到 `GroupAggregate` 可以启用两阶段优化,优化器(optimizer)将会把建议 id 附在 `GroupAggregate` 节点内作为索引,在最后附上建议内容。

Review Comment:
   -> '若检测到分组聚合可以启用两阶段优化但未开启时'



##########
docs/content.zh/docs/dev/table/sql/explain.md:
##########
@@ -274,19 +331,190 @@ Union(all=[true], union=[count, word])
 <a name="explaindetails"></a>
 
 ## ExplainDetails
+使用指定的 `ExplainDetail` 类型来打印语句的计划。
+
+**ESTIMATED_COST**
+
+指定 `ESTIMATED_COST` 将使得优化器(optimizer)将估算出的成本信息附加在每个物理节点上输出。
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+指定 `CHANGELOG_MODE` 将使得优化器(optimizer)将 changelog mode 附加在每个物理节点上输出。
+关于 changelog mode 更多信息请参阅 [动态表]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)。
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+指定 `PLAN_ADVICE` 将使得优化器(optimizer)分析优化后的物理执行计划并提供潜在的数据风险预警或性能调优建议。
+此时输出标题将会从 “Optimized Physical Plan” 变为 “Optimized Physical Plan with Advice” 作为提示。
+
+针对物理计划的建议按照 **类型** 和 **范围** 来区分。
+
+| 建议类型    | 说明             |
+|:--------|:---------------|
+| WARNING | 给出潜在的数据正确性风险   |
+| ADVICE  | 给出可能的 SQL 调优建议 |
+
+
+| 建议范围        | 说明           |
+|:------------|:-------------|
+| QUERY_LEVEL | 针对整个 SQL 的建议 |
+| NODE_LEVEL  | 针对单个物理节点的建议  |
+
+目前 Flink SQL 提供针对如下问题的建议
+- 数据倾斜(更多信息请参阅 [性能调优]({{< ref "docs/dev/table/tuning" >}}#local-global-aggregation))

Review Comment:
   -> '分组聚合(Group Aggregation)时的数据倾斜' 
   and attach the `Group Aggregation` doc link



##########
docs/content/docs/dev/table/sql/explain.md:
##########
@@ -269,18 +326,190 @@ Union(all=[true], union=[count, word])
 {{< top >}}
 
 ## ExplainDetails
+`ExplainDetail` defines the types of details for explain result.
+
+**ESTIMATED_COST**
+
+Specify `ESTIMATED_COST` will inform the optimizer to attach the estimated optimal cost of each physical rel node to the output.
+
+```text
+== Optimized Physical Plan ==
+TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 0.0 network, 0.0 memory})
+```
+
+**CHANGELOG_MODE**
+
+Specify `CHANGELOG_MODE` will inform the optimizer to attach the changelog mode (see more details at [Dynamic Tables]({{< ref "docs/dev/table/concepts/dynamic_tables" >}}#table-to-stream-conversion)) of each physical rel node to the ouptput.
+
+```text
+== Optimized Physical Plan ==
+GroupAggregate(..., changelogMode=[I,UA,D])
+```
+
+**PLAN_ADVICE**
+
+Specify `PLAN_ADVICE` will inform the optimizer to analyze the optimized physical plan to provide the potential risk warnings and optimization advice.
+Meanwhile, it will change the title of "Optimized Physical Plan" to "Optimized Physical Plan with Advice" as the highlight.
+
+Plan advice is categorized by **Kind** and **Scope**.
+
+| Advice Kind | Description                                              |
+|:------------|:---------------------------------------------------------|
+| WARNING     | It reveals potential data correctness risks              |
+| ADVICE      | It suggests potential SQL optimizer tuning configuration |
+
+
+| Advice Scope | Description                                                       |
+|:-------------|:------------------------------------------------------------------|
+| QUERY_LEVEL  | It provides advice from a global view, targeting the entire query |
+| NODE_LEVEL   | It provides advice to a specific rel node                         |
+
+Currently, Flink SQL provides the plan advice targeting the following issues
+- Data Skewness (see more details at [Performance Tuning]({{< ref "docs/dev/table/tuning" >}}#local-global-aggregation))

Review Comment:
   -> 'Data Skewness in [Group Aggregation](doc ref...)'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org