Skip to content

Commit dd0a8ac

Browse files
💬Generate LLM translations (#2049)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b5a2274 commit dd0a8ac

File tree

1 file changed

+51
-35
lines changed

1 file changed

+51
-35
lines changed

docs/cn/sql-reference/10-sql-commands/40-explain-cmds/explain-analyze-graphical.md

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,66 @@ title: EXPLAIN ANALYZE GRAPHICAL
44

55
import FunctionDescription from '@site/src/components/FunctionDescription';
66

7-
<FunctionDescription description="Introduced: v1.2.647"/>
7+
<FunctionDescription description="Introduced or updated: v1.2.647"/>
88

9-
`EXPLAIN ANALYZE GRAPHICAL` 用于打开一个浏览器页面,以显示查询执行计划以及实际的运行时性能统计信息
9+
`EXPLAIN ANALYZE GRAPHICAL` 是 BendSQL 客户端独有的命令。它允许您通过自动启动默认浏览器并呈现查询执行过程的交互式可视化表示来分析 SQL 查询的性能和执行计划
1010

11-
这对于分析查询性能和识别查询中的瓶颈非常有用。
12-
13-
**注意:** 此功能仅在 BendSQL 中可用。
11+
此命令仅在 BendSQL v0.22.2 及更高版本中受支持。在使用它之前,请确保您的 BendSQL 已正确配置。有关设置说明,请参阅 [配置 BendSQL](#configuring-bendsql)
1412

1513
## 语法
1614

1715
```sql
1816
EXPLAIN ANALYZE GRAPHICAL <statement>
1917
```
2018

19+
## 配置 BendSQL
20+
21+
要启用图形分析并自动打开默认浏览器,请将以下部分添加到 BendSQL 配置文件 `~/.config/bendsql/config.toml` 中:
22+
23+
```toml
24+
[server]
25+
bind_address = "127.0.0.1"
26+
auto_open_browser = true
27+
```
28+
2129
## 示例
2230

23-
TPC-H Q21:
31+
您可以使用 `EXPLAIN ANALYZE GRAPHICAL` 来分析复杂查询(例如 TPC-H 基准查询)的性能,并了解查询的每个部分如何影响整体执行时间。
2432

25-
```sql
26-
EXPLAIN ANALYZE GRAPHICAL SELECT s_name,
27-
-> Count(*) AS numwait
28-
-> FROM supplier,
29-
-> lineitem l1,
30-
-> orders,
31-
-> nation
32-
-> WHERE s_suppkey = l1.l_suppkey
33-
-> AND o_orderkey = l1.l_orderkey
34-
-> AND o_orderstatus = 'F'
35-
-> AND l1.l_receiptdate > l1.l_commitdate
36-
-> AND EXISTS (SELECT *
37-
-> FROM lineitem l2
38-
-> WHERE l2.l_orderkey = l1.l_orderkey
39-
-> AND l2.l_suppkey <> l1.l_suppkey)
40-
-> AND NOT EXISTS (SELECT *
41-
-> FROM lineitem l3
42-
-> WHERE l3.l_orderkey = l1.l_orderkey
43-
-> AND l3.l_suppkey <> l1.l_suppkey
44-
-> AND l3.l_receiptdate > l3.l_commitdate)
45-
-> AND s_nationkey = n_nationkey
46-
-> AND n_name = 'EGYPT'
47-
-> GROUP BY s_name
48-
-> ORDER BY numwait DESC,
49-
-> s_name
50-
-> LIMIT 100;
51-
52-
// 将打开一个浏览器页面,以显示查询执行计划和性能统计信息。
53-
```
33+
这是一个示例查询,用于计算 `lineitem` 表中的聚合:
34+
35+
```bash
36+
eric@(eric-xsmall)/tpch_100> EXPLAIN ANALYZE GRAPHICAL select
37+
l_returnflag,
38+
l_linestatus,
39+
sum(l_quantity) as sum_qty,
40+
sum(l_extendedprice) as sum_base_price,
41+
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
42+
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
43+
avg(l_quantity) as avg_qty,
44+
avg(l_extendedprice) as avg_price,
45+
avg(l_discount) as avg_disc,
46+
count(*) as count_order
47+
from
48+
lineitem
49+
where
50+
l_shipdate <= add_days(to_date('1998-12-01'), -90)
51+
group by
52+
l_returnflag,
53+
l_linestatus
54+
order by
55+
l_returnflag,
56+
l_linestatus;
57+
```
58+
59+
运行命令后,BendSQL 会输出一条消息,例如:
60+
61+
```bash
62+
View graphical online: http://127.0.0.1:8080?perf_id=1
63+
64+
1095 rows graphical in 21.762 sec. Processed 0 rows, 0 B (0 row/s, 0 B/s)
65+
```
66+
67+
这会自动打开您的默认浏览器,并显示查询执行计划的交互式图形视图,包括运算符运行时、行数以及各个 Stage 之间的数据流。
68+
69+
![alt text](@site/static/img/documents/sql/explain-graphical.png)

0 commit comments

Comments
 (0)