News for hackers. Stuff that matters.
Re:Postgres Query Plan Visualization by valgog on Sunday January 24, 2016 @06:07AM (#10962191)
Wow, wonderful work!

As an additional information about already existing execution plan visualisation tools:

Depesz has written the classical PostgreSQL Execution Plan Visualiser years ago.

http://explain.depesz.com/

Of cause it is not so nicely pretty as the one from Tatiyants, but I use it now and then and it became a standard explain visualisation tool for many PostgreSQL users.

The table format from http://explain.depesz.com/ is very useful and one can understand a lot of details about your execution plan without the need to visualise in the form of a graph.

Also the default execution plan visualiser in pgAdmin looks really cool.

Re:Postgres Query Plan Visualization by atatiyan on Sunday January 24, 2016 @12:33PM (#10963171)
Thank you. Pev was definitely influenced by explain.depesz, it's a great tool
Re:Postgres Query Plan Visualization by pmontra on Sunday January 24, 2016 @05:51AM (#10962164)
That page yields a 504 Gateway Time-out right now. Cached at http://webcache.googleusercontent.com/search?q=cache:jH9Wl8R...

The demo at http://tatiyants.com/pev/#/plans works.

Unfortunately it has some glitches.

Hints for using it:

* In psql use \o plan.txt to redirect the output of explain to a file. It will be a long output because you must use EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) and copying it from the terminal won't be fun.

* Remove the first two lines (header) and the last two (footer) leaving only the json data. Remove all the + characters at the end of every line. Suggestion to the author: the tool should handle that.

That said, it works. It really is much clearer than the output of explain in the terminal and as a result I'm googling how to speed up sort now. Thanks.

Re:Postgres Query Plan Visualization by colanderman on Sunday January 24, 2016 @01:32PM (#10963413)

    \a
    \t
is what you want. (\a, unaligned mode, removes the + characters, and \t, tuples only, removes the header and footer.)
Re:Postgres Query Plan Visualization by pmontra on Monday January 25, 2016 @01:40PM (#10968964)
Thanks
Re:Postgres Query Plan Visualization by janfoeh on Sunday January 24, 2016 @05:37AM (#10962146)
It seems to be getting hammered in the moment, so I can't give it a spin right now, but just from your explanation this looks fantastic.

For some reason I just cannot parse Postgres' query planner output, so this might help me understand EXPLAINs for the first time. Thanks for sharing!

Re:Postgres Query Plan Visualization by pmontra on Sunday January 24, 2016 @05:51AM (#10962167)
See the hints in my other comment.
Re:Postgres Query Plan Visualization by orf on Sunday January 24, 2016 @09:26AM (#10962565)
This looks great, much better than the pgadmin output! A good feature would be an CLI tool we could pipe output to, i.e `psql some_long_query | pev`, which would bring back a URL we could open.
Re:Postgres Query Plan Visualization by dveeden2 on Sunday January 24, 2016 @06:24AM (#10962220)
MySQL Workbench recently also got a visual explain option. This is very useful, don't know why everyone keeps struggling with a text format (especially for large explain plans).

https://www.mysql.com/common/images/products/mysql_wb_visual...

Re:Postgres Query Plan Visualization by morenoh149 on Sunday January 24, 2016 @12:01PM (#10963038)
for those whole couldn't get the anonymous cvs access working. I put the sample db on github https://github.com/morenoh149/postgresDBSamples/tree/master/...
Re:Postgres Query Plan Visualization by ris on Sunday January 24, 2016 @10:48AM (#10962808)
This looks very nice.

Something I've wanted in a postgres query plan visualizer is a "timeline" view of the various nodes. Seeing as for each node we get a "start time" and "duration" it seems like it should be possible to draw something a little like a flame graph to see at what points the nodes are doing their work.

Re:Postgres Query Plan Visualization by atatiyan on Sunday January 24, 2016 @12:32PM (#10963168)
Hi, I created Pev. This should be possible to do since you can graph durations and they're even color coded (red being the slowest and green being the fastest)
Re:Postgres Query Plan Visualization by barrkel on Sunday January 24, 2016 @11:06AM (#10962860)
The output from postgres explain is already in a very readable format when you compare it with the mishmash from mysql. A nice tree view all adding up. If you're aware of how evaluating a SQL query actually works, it's very straightforward.

MySQL, meanwhile, just gives you a list of things, with random lists of indexes and keywords (like temporary, filesort, derived, etc), and estimates of row counts. Piecing together the data flow back into a tree format that maps to the syntax tree of your SQL query is not so easy.

Re:Postgres Query Plan Visualization by andrewvc on Sunday January 24, 2016 @08:50AM (#10962475)
Awesome! I used this the other day and it is great. The site seems to be down, I recommend bookmarking it and coming back!
Re:Postgres Query Plan Visualization by banku_brougham on Sunday January 24, 2016 @11:38AM (#10962963)
Thank you!!!! This will make my life easier and more fun.
Re:Postgres Query Plan Visualization by jedberg on Sunday January 24, 2016 @12:38PM (#10963188)
I wish I had this five years ago when I was dealing with Postgres query planning every day!

Nowadays I just avoid it by using NoSql (which to be fair gives me a whole different set of problems). :)