Re: [HACKERS] Anyone for prettyprinted EXPLAIN VERBOSE? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Anyone for prettyprinted EXPLAIN VERBOSE?
Date
Msg-id 199912180033.TAA19425@candle.pha.pa.us
Whole thread Raw
In response to Anyone for prettyprinted EXPLAIN VERBOSE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Anyone for prettyprinted EXPLAIN VERBOSE?
Re: [HACKERS] Anyone for prettyprinted EXPLAIN VERBOSE?
List pgsql-hackers
I remember Jan saying he liked the compressed one.


> 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 
>          :basetype 23 
>          :aggtype 23 
>          :target 
>             { VAR 
>             :varno 0 
>             :varattno 1 
>             :vartype 23 
>             :vartypmod -1  
>             :varlevelsup 0 
>             :varnoold 1 
>             :varoattno 1
>             }
>           
>          :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 
>             :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
> 
> ************
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] psql/sql_help.h
Next
From: Vince Vielhaber
Date:
Subject: RE: [HACKERS] Mail list archive search busted?