Anyone for prettyprinted EXPLAIN VERBOSE? - Mailing list pgsql-hackers

From Tom Lane
Subject Anyone for prettyprinted EXPLAIN VERBOSE?
Date
Msg-id 11821.945473665@sss.pgh.pa.us
Whole thread Raw
Responses Re: [HACKERS] Anyone for prettyprinted EXPLAIN VERBOSE?
List pgsql-hackers
When you do an EXPLAIN VERBOSE, two different representations of the
query plan are produced.  The client sees something like this:

regression=> explain verbose select sum(f1) from int4_tbl;
NOTICE:  QUERY DUMP:

{ AGG :cost 1.165 :size 5 :width 4 :state <> :qptargetlist ({ TARGETENTRY :resdom { RESDOM :resno 1 :restype 23
:restypmod-1 :resname "sum" :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { AGGREG :aggname sum
:basetype23 :aggtype 23 :target { VAR :varno 0 :varattno 1 :vartype 23 :vartypmod -1  :varlevelsup 0 :varnoold 1
:varoattno1} :usenulls false }}) :qpqual <> :lefttree { SEQSCAN :cost 1.165 :size 5 :width 4 :state <> :qptargetlist ({
TARGETENTRY:resdom { RESDOM :resno 1 :restype 23 :restypmod -1 :resname "<>" :reskey 0 :reskeyop 0 :ressortgroupref 0
:resjunkfalse } :expr { VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1  :varlevelsup 0 :varnoold 1 :varoattno 1}})
:qpqual<> :lefttree <> :righttree <> :extprm () :locprm () :initplan <> :nprm 0  :scanrelid 1 } :righttree <> :extprm
():locprm () :initplan <> :nprm 0 }
 

but in the postmaster log we format it like this:

NOTICE:  QUERY PLAN:

Aggregate  (cost=1.16 rows=5 width=4) ->  Seq Scan on int4_tbl  (cost=1.16 rows=5 width=4)

{ AGG   :cost 1.165   :size 5   :width 4   :state <>   :qptargetlist (     { TARGETENTRY      :resdom         { RESDOM
      :resno 1         :restype 23         :restypmod -1         :resname "sum"         :reskey 0         :reskeyop 0
     :ressortgroupref 0         :resjunk false         }           :expr         { AGGREG         :aggname sum
:basetype23         :aggtype 23         :target            { VAR            :varno 0            :varattno 1
:vartype23            :vartypmod -1             :varlevelsup 0            :varnoold 1            :varoattno 1
}                :usenulls false         }     }  )     :qpqual <>   :lefttree      { SEQSCAN      :cost 1.165
:size5      :width 4      :state <>      :qptargetlist (        { TARGETENTRY         :resdom            { RESDOM
    :resno 1            :restype 23            :restypmod -1            :resname "<>"            :reskey 0
:reskeyop0            :ressortgroupref 0            :resjunk false            }                 :expr            { VAR
         :varno 1            :varattno 1            :vartype 23            :vartypmod -1             :varlevelsup 0
      :varnoold 1            :varoattno 1           }        }     )           :qpqual <>      :lefttree <>
:righttree<>      :extprm ()           :locprm ()           :initplan <>      :nprm 0       :scanrelid 1      }
:righttree<>   :extprm ()     :locprm ()     :initplan <>   :nprm 0   }
 

Does anyone think that the first form has any conceivable use?  I would
like to get rid of it and deliver the prettyprinted format to both log
and client.  I think it may have been done this way because old versions
of the backend didn't cope very gracefully with sending long NOTICE
messages to the client, but that constraint is history...
        regards, tom lane


pgsql-hackers by date:

Previous
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] LONG varsize - how to go on
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock