Re: Plan targetlists in EXPLAIN output

From: Tom Raney <twraney(at)comcast(dot)net>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Plan targetlists in EXPLAIN output
Date: 2008-06-19 22:20:26
Message-ID: 485ADBAA.9080702@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have been working on a project (for GSOC) to retrieve
planner/optimizer details. As part of the project, I need machine
parsable output. So, I thought I would dust off a patch I found from
last year that Germán Caamaño submitted. I didn't see any further
activity there so I integrated it into 8.4 and added a DTD.

The output below is generated by using the added flag 'XML' to the
EXPLAIN command. The DTD probably wouldn't be needed for every output
instance and may need its own flag.

I am coming up to speed on the planner internals, but it seems like this
first EXPLAIN XML concept may have some use. Are there any strong
opinions about the XML hierarchy? Is it enough to simply wrap the text
output from EXPLAIN with XML tags?

-Tom Raney

QUERY PLAN
-------------------------------------------------------------------
<?xml version="1.0"?>

<!DOCTYPE explain
[
<!ELEMENT explain (plan+) >
<!ELEMENT plan (table?, cost, qualifier?) >
<!ELEMENT table EMPTY >
<!ELEMENT cost EMPTY >
<!ELEMENT qualifier EMPTY >
<!ATTLIST explain
version CDATA #REQUIRED >
<!ATTLIST plan
name CDATA #REQUIRED
level CDATA #REQUIRED >
<!ATTLIST cost
startup CDATA #REQUIRED
total CDATA #REQUIRED
rows CDATA #REQUIRED
width CDATA #REQUIRED >
<!ATTLIST table
name CDATA #REQUIRED >
<!ATTLIST qualifier
type CDATA #REQUIRED
value CDATA #REQUIRED >
]>

<explain version="8.4devel">
<plan name="Seq Scan" level="0">
<table name="tenk1"/>
<cost startup="0.00" total="445.00" rows="10000" width="244" />
</plan>
</explain>
(32 rows)

Greg Smith wrote:
> On Thu, 17 Apr 2008, Tom Lane wrote:
>
>> For debugging the planner work I'm about to do, I'm expecting it will be
>> useful to be able to get EXPLAIN to print the targetlist of each plan
>> node, not just the quals (conditions) as it's historically done.
>
> I've heard that some of the academic users of PostgreSQL were hoping
> to add features in this area in order to allow better using planner
> internals for educational purposes. It would be nice if that were
> available for such purposes without having to recompile.
>
> --
> * Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2008-06-19 23:19:46 Re: posix advises ...
Previous Message Melvin Davidson 2008-06-19 22:18:14 TRIGGER or RULE for SELECT