Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,38 @@ import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.647"/>

`EXPLAIN ANALYZE GRAPHICAL` is a command available exclusively in the BendSQL client. It allows you to analyze the performance and execution plan of a SQL query by automatically launching your default browser and presenting an interactive visual representation of the query execution process.

This command is supported only in BendSQL v0.22.2 and above. Before using it, ensure that your BendSQL is properly configured. For setup instructions, see [Configuring BendSQL](#configuring-bendsql).
Analyzes query performance with an interactive visual representation in your browser. Available exclusively in BendSQL v0.22.2+.

## Syntax

```sql
EXPLAIN ANALYZE GRAPHICAL <statement>
```

## Configuring BendSQL
## Configuration

To enable graphical analysis and automatically open your default browser, add the following section to your BendSQL configuration file `~/.config/bendsql/config.toml`:
Add to your BendSQL config file `~/.config/bendsql/config.toml`:

```toml
[server]
bind_address = "127.0.0.1"
auto_open_browser = true
```

## Examples

You can use `EXPLAIN ANALYZE GRAPHICAL` to analyze the performance of complex queries, such as TPC-H benchmark queries, and understand how each part of the query contributes to overall execution time.
## Example

Here is an example query that calculates aggregates from the `lineitem` table:

```bash
eric@(eric-xsmall)/tpch_100> EXPLAIN ANALYZE GRAPHICAL select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= add_days(to_date('1998-12-01'), -90)
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
```sql
EXPLAIN ANALYZE GRAPHICAL SELECT l_returnflag, COUNT(*)
FROM lineitem
WHERE l_shipdate <= '1998-09-01'
GROUP BY l_returnflag;
```

After running the command, BendSQL outputs a message like:

Output:
```bash
View graphical online: http://127.0.0.1:8080?perf_id=1

1095 rows graphical in 21.762 sec. Processed 0 rows, 0 B (0 row/s, 0 B/s)
```

This automatically opens your default browser and shows an interactive graphical view of the query execution plan, including operator runtimes, row counts, and data flow between stages.
Opens an interactive view showing execution plan, operator runtimes, and data flow.

![alt text](@site/static/img/documents/sql/explain-graphical.png)
![Graphical Analysis](@site/static/img/documents/sql/explain-graphical.png)

This file was deleted.

This file was deleted.

13 changes: 11 additions & 2 deletions docs/en/sql-reference/10-sql-commands/40-explain-cmds/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
---
title: Explain Commands
---
import IndexOverviewList from '@site/src/components/IndexOverviewList';

This page provides reference information for the explain-related commands in Databend.

<IndexOverviewList />
## Commands Overview

| Command | Use Case |
|---------|----------|
| [`EXPLAIN`](./explain) | Understanding query structure and optimization |
| [`EXPLAIN ANALYZE`](./explain-analyze) | Performance analysis with runtime statistics |
| [`EXPLAIN ANALYZE GRAPHICAL`](./explain-analyze-graphical) | Visual performance analysis (BendSQL only) |
| [`EXPLAIN AST`](./explain-ast) | SQL parsing and syntax analysis |
| [`EXPLAIN PERF`](./explain-perf) | Query performance profiling (BendSQL only) |
| [`EXPLAIN RAW`](./explain-raw) | Internal query processing analysis |
| [`EXPLAIN SYNTAX`](./explain-syntax) | SQL code formatting and standardization |
Loading