AlexTatiyants/pev(opens in a new tab)
Language: TypeScript
Postgres Explain Visualizer
- stars
- 2,803
- watchers
- 51
- forks
- 187
- open issues
- 31
- Last updated
- 10/09/2026
Language: TypeScript
Postgres Explain Visualizer
Postgres Explain Visualizer (pev) is designed to make EXPLAIN output easier to grok. It creates a graphical representation of the plan. You can read about it on my blog.
Pev is heavily influenced by the excellent explain.depesz.com.
auto_explain log entries (which bring the query along)For best results, generate plans with:
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, SETTINGS, FORMAT JSON) <your query>;
Plans are stored in your browser's localStorage and never leave your machine.
https://tatiyants.com/pev/#/import?plan=...&query=...&name=... opens a plan directly. Everything after the # stays in the browser: it is never sent to the server. plan and query take plain URI-encoded text, or use plan_gz and query_gz for gzipped, base64-encoded values, which keeps links to big plans short. For example, from a shell:
psql -XqAt -c "EXPLAIN (ANALYZE, BUFFERS, VERBOSE, FORMAT JSON) SELECT ..." > plan.json open "https://tatiyants.com/pev/#/import?plan_gz=$(gzip -c plan.json | base64 | tr -d '\n' | tr '+/' '-_' | tr -d '=')"
The link button next to a plan's name copies such a link for any plan you have open.
Pev is a React + TypeScript app built with Vite. It requires Node 20 or later.
npm install
npm run dev
Other scripts:
npm test runs the unit tests (Vitest)npm run typecheck type-checks the projectnpm run build produces a static build in dist/ that can be hosted anywhere (it uses relative paths, so it works under a sub-path like /pev/)The interesting code lives in src/lib:
parse.ts and textParser.ts turn JSON or text EXPLAIN output into a common shapeanalyze.ts computes per-node metrics (exclusive time, buffers, estimates) and tags outliersinsights.ts turns the analysis into plain-language findingslayout.ts and flame.ts lay out the tree and flame viewshighlight.ts maps plan nodes back to the SQL queryshare.ts reads and builds plan links