r/Database • • 8d ago

A free page that draws a PostgreSQL EXPLAIN ANALYZE plan as row flow

Post image

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:

https://seqora.dev/explain/

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.

23 Upvotes

6 comments sorted by

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. 😉

1

u/duoroo 8d ago

haha fair, I've spent too long looking at it and skipped explaining what the lines actually mean

really need to work on documentation and portraying in such a way that its easier to scan, thanks again for the feedback good sir 🤠

2

u/decrementsf 8d ago

Those are words, I think.

1

u/duoroo 8d ago

xD yeah, I made a tool to explain things visually then got lost explaining it in words

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.

1

u/duoroo 8d ago

Yeah that would make it much easier to connect back to the plan. i'll work on proper legends, I think documentation needs lots of work. Thanks for the input 👍