Making EXPLAIN more verbose

In PostgreSQL, the output of an EXPLAIN clause can be beefed up a little to provide you with more information. To extract as much as possible out of a plan, consider turning the following options on:

test=# EXPLAIN (analyze, verbose, costs, timing, buffers)   SELECT * FROM a ORDER BY random(); 
                          QUERY PLAN -----------------------------------------------------------------  Sort (cost=834.39..859.39 rows=10000 width=12)          (actual time=6.089..7.199 rows=10000 loops=1)    Output: aid, (random())    Sort Key: (random())    Sort Method: quicksort Memory: 853kB    Buffers: shared hit=45    -> Seq Scan on public.a          (cost=0.00..170.00 rows=10000 width=12)          (actual time=0.012..2.625 rows=10000 loops=1)          Output: aid, random()  Buffers: ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.