Crates.io | rustcmdpev |
lib.rs | rustcmdpev |
version | 0.1.0 |
source | src |
created_at | 2020-10-06 18:01:33.883911 |
updated_at | 2020-10-06 18:01:33.883911 |
description | A Postgres query visualizer |
homepage | |
repository | https://github.com/treble37/rustcmdpev |
max_upload_size | |
id | 296672 |
size | 44,096 |
A command-line Rust Postgres query visualizer, heavily inspired by the excellent (web-based) pev. It started out being ported from gocmdpev
Generate a query plan with all the trimmings by prefixing your query with:
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)
Then pipe the resulting query plan into rustcmdpev
.
On MacOS you can just grab a query on your clipboard and run this one-liner:
pbpaste | sed '1s/^/EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) /' | psql -qXAt <DATABASE> | rustcmdpev
cargo run -- '[{"Plan":{"Alias":"c0","Node Type":"Seq Scan","Parallel Aware":false,"Plan Rows":50,"Plan Width":1572,"Relation Name":"coaches","Startup Cost":0.0,"Total Cost":10.5}}]'
To see output from print statements, run with nocapture flag:
cargo test -- --nocapture