On 6/13/07, Gregory Stark <stark@enterprisedb.com> wrote:
> I'm not a fan either so perhaps I'm biased, but this seems like a good example
> of where it would be an *awful* idea.
>
> Once you have an XML plan what can you do with it? All you can do is parse it
> into constituent bits and display it.
"...and display it" -- this, I suppose, covers the most frequent needs
(starting from displaying entire plans in some tools and finishing
with odd but useful examples like
http://archives.postgresql.org/pgsql-sql/2005-08/msg00046.php).
> You cant do any sort of comparison
> between plans, aggregate results, search for plans matching constraints, etc.
Wrong.
> How would I, with XML output, do something like:
>
> SELECT distinct node.relation
> FROM plan_table
> WHERE node.expected_rows < node.actual_rows*2;
>
> or
>
> SELECT node.type, average(node.ms/node.cost)
> FROM plan_table
> GROUP BY node.type;
XPath can help here. Now almost every language has XML with XPath
support. That's the point, that's why XML is suitable here -- it
simplifies application development (in this specific case ;-) ).
--
Best regards,
Nikolay