https://github.com/sanpii/explain
Transform postgresql explain to a graph
https://github.com/sanpii/explain
explain postgresql
Last synced: 10 months ago
JSON representation
Transform postgresql explain to a graph
- Host: GitHub
- URL: https://github.com/sanpii/explain
- Owner: sanpii
- Created: 2020-03-13T20:53:10.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-25T18:30:56.000Z (about 1 year ago)
- Last Synced: 2025-04-01T01:01:43.247Z (12 months ago)
- Topics: explain, postgresql
- Language: Rust
- Homepage:
- Size: 12.5 MB
- Stars: 57
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: docs/README.md
- Funding: docs/FUNDING.yml
Awesome Lists containing this project
README
# Explain
[](https://github.com/sanpii/explain/actions?query=workflow%3A.github%2Fworkflows%2Fci.yml)
[](https://gitlab.com/sanpi/explain/commits/main)
Transform postgresql explain to a graph.
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_1.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_2.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_3.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_4.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_5.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_large.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_parallel.png)
[
](https://raw.githubusercontent.com/sanpii/explain/main/examples/plan_trigger.png)
## Install
[](https://repology.org/project/explain/versions)
If you use Arch Linux, explain is available in
[AUR](https://aur.archlinux.org/packages/explain/).
### Manually
```bash
git clone https://github.com/sanpii/explain
cd explain
make
sudo make install
```
## Launch
Launch this program like `psql` and use `dot` to generate image:
```
$ explain --command 'select 1' database | dot -Tpng > explain.png
```
```
$ explain --help
explain 1.0.0
USAGE:
explain [FLAGS] [OPTIONS] [dbname]
FLAGS:
--analyse this option executes explain analyse /!\ Be carful, that executes the query!
-n, --dry-run Don’t execute the query, the input is already an explain plan in JSON
--help Prints help information
-W, --password Prompt for a password before connecting to a database
-V, --version Prints version information
OPTIONS:
-c, --command Specifies the command to execute
-f, --file Read commands from the file, rather than standard input
-h, --host Specifies the host name of the machine on which the server is running
-o, --output Put output into file
-p, --port Specifies the TCP port on which the server is listening for connections
-U, --user Connect to the database as the user
ARGS:
Specifies the name of the database to connect to
```