r/Database • u/duoroo • 8d ago
A free page that draws a PostgreSQL EXPLAIN ANALYZE plan as row flow
The part of a Postgres plan that's hard to read by eye is the row counts. They are per loop, and the estimate sits beside the actual with nothing to show how far apart the two are.
So I drew them. Each band is as wide as the rows that crossed it, over every loop. Where the estimate is off by more than 2×, it is drawn on the band: in the screenshot the planner expected 612 rows from `orders` and got 206,880, and every join after it inherits that.
Paste `EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)` output or the text format:
The plan is read in the page and isn't uploaded. It draws one plan at a time, saves nothing, and can't see your database.
I make Seqora, a desktop database client, and this is its plan view. In the app it runs EXPLAIN on your own connection, and that part is paid. The page is free.
4
u/Imaginary__Bar 8d ago
Nice tool; documentation needs work.
"Each band is as wide as the rows that crossed it, over every loop. Where the estimate is off by more than 2x, it is drawn on the band"
I'm sure that makes sense to you. 😉
2
u/decrementsf 8d ago
Those are words, I think.
2
u/Discordbothost 8d ago
A tiny example in the legend would help. If the plan says 10 actual rows and 50 loops, the band is 500 rows wide. Show the 10 x 50 next to the band so people can map it back to EXPLAIN.