Waiting for 9.4 – Improve EXPLAIN to print the grouping columns in Agg and Group nodes.

On 12th of December, Tom Lane committed patch:

Improve EXPLAIN to print the grouping columns in Agg and Group nodes.
 
Per request from Kevin Grittner.

Well, the description is pretty simple, so let's just see it in some example:

Before:

                                                          QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=63239.58..65800.66 ROWS=102443 width=887) (actual TIME=3749.183..19549.198 ROWS=117 loops=1)
   ->  Sort  (cost=63239.58..63495.69 ROWS=102443 width=887) (actual TIME=3457.795..3542.012 ROWS=105676 loops=1)
         Sort KEY: (date_trunc('month'::text, entered_on)), is_public
         Sort Method: external MERGE  Disk: 91672kB
         ->  Seq Scan ON plans  (cost=0.00..14796.54 ROWS=102443 width=887) (actual TIME=12.963..3139.596 ROWS=105676 loops=1)
 Total runtime: 19569.330 ms
(6 ROWS)

Now:

                                                         QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=144020.88..146662.33 ROWS=105658 width=871) (actual TIME=469.468..4484.059 ROWS=117 loops=1)
   GROUP KEY: (date_trunc('month'::text, entered_on)), is_public
   ->  Sort  (cost=144020.88..144285.02 ROWS=105658 width=871) (actual TIME=464.047..524.744 ROWS=105658 loops=1)
         Sort KEY: (date_trunc('month'::text, entered_on)), is_public
         Sort Method: external MERGE  Disk: 91384kB
         ->  Seq Scan ON plans  (cost=0.00..13855.73 ROWS=105658 width=871) (actual TIME=7.182..109.704 ROWS=105658 loops=1)
 Total runtime: 4598.598 ms
(7 ROWS)

The change is rather simple, but I like that it's more information to user, and it's symmetrical to, already present, key info for sort nodes.

Cool stuff, thanks Tom.