felixge / felixge/flame-explain

Better support for psql

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
55
Forks
5
PR merge metrics
No merged PRs in 30d

Description

# Problem

psql is the command line PostgreSQL client that is part of PostgreSQL itself, so it's very popular.

However, when using it with `EXPLAIN ANALYZE`, it adds a lot of undesirable characters to the text output, especially the `+` symbols at the end of every line, see below:

```
$ psql
psql (11.6)
Type "help" for help.

postgres=# EXPLAIN (ANALYZE, FORMAT JSON, VERBOSE, BUFFERS) SELECT 1;
QUERY PLAN
-------------------------------------
[ +
{ +
"Plan": { +
"Node Type": "Result", +
"Parallel Aware": false, +
"Startup Cost": 0.00, +
"Total Cost": 0.01, +
"Plan Rows": 1, +
"Plan Width": 4, +
"Actual Startup Time": 0.004,+
"Actual Total Time": 0.005, +
"Actual Rows": 1, +
"Actual Loops": 1, +
"Output": ["1"], +
"Shared Hit Blocks": 0, +
"Shared Read Blocks": 0, +
"Shared Dirtied Blocks": 0, +
"Shared Written Blocks": 0, +
"Local Hit Blocks": 0, +
"Local Read Blocks": 0, +
"Local Dirtied Blocks": 0, +
"Local Written Blocks": 0, +
"Temp Read Blocks": 0, +
"Temp Written Blocks": 0 +
}, +
"Planning Time": 0.168, +
"Triggers": [ +
], +
"Execution Time": 0.082 +
} +
]
(1 row)
```

# Proposal

Allow users to paste the bad psql output and automatically remove the trailing `+` characters for them. Perhaps also ignore the header and footer:

```
QUERY PLAN
-------------------------------------
```
```
(1 row)
```

Alternatively, or perhaps in addition, figure out if it's possible to tell psql to not use this stupid output format and create a documentation page for psql users that tells them what options to use.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.