Re: machine-readable explain output - Mailing list pgsql-hackers

From Andres Freund
Subject Re: machine-readable explain output
Date
Msg-id 4A377FB6.7040601@anarazel.de
Whole thread Raw
In response to machine-readable explain output  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: machine-readable explain output  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
Hi,

On 06/12/2009 07:15 AM, Robert Haas wrote:
> If you don't like the syntax, please argue about that on the "generic
> explain options v2" thread.  Let's try to use this thread to discuss
> the output format, about which I spent a good deal of time agonizing.
I spent some time playing around with the explain output with various 
queries. Beside the already raised mild dislike (from Peter Eisentraut I 
think) of Upper-Case "-" seperated tag-names I found mainly one gripe:

<Startup-Cost>1710.98</Startup-Cost>
<Total-Cost>1710.98</Total-Cost>
<Plan-Rows>72398</Plan-Rows>
<Plan-Width>4</Plan-Width>
<Actual-Startup-Time>136.595</Actual-Startup-Time>
<Actual-Total-Time>136.595</Actual-Total-Time>
<Actual-Rows>72398</Actual-Rows>
<Actual-Loops>1</Actual-Loops>

This is a bit inconsistent. i.e. for the row estimate you use 
<Plan-Rows/> and for <Startup-Cost/> you dont use the "Plan-" Prefix.
While for the 'analyze' generated variables you use the 'Actual-' prefix 
consistently.

One approach would be to have two nodes like:
<Plan-Estimates>    <Startup-Cost>...</Startup-Cost>    ...
</Plan-Estimates>
<Execution-Cost>    <Startup-Cost>...</Startup-Cost>    ...
</Execution-Cost>

This would probably make it easier to write a future proof parser and it 
also seems semantically sensible.


As an aside issue it would perhaps be nice (thinking of an 
index-suggestion tool) to make it possible for having seperate estimates 
on <Index-Cond> an <Filter> - In order not to change the format later 
that perhaps has to be considered here.
Perhaps the current structure + some additional tags is also the best 
here - I just noticed it being a potential issue.

Andres


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Partial vacuum versus pg_class.reltuples
Next
From: Stephen Frost
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen