Re: machine-readable explain output v4

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Mike <ipso(at)snappymail(dot)ca>, Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: machine-readable explain output v4
Date: 2009-08-12 16:07:25
Message-ID: 4A82E8BD.4050706@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Csaba Nagy wrote:
> On Wed, 2009-08-12 at 17:11 +0200, Andrew Dunstan wrote:
>
>> That will just make things worse. And it will break if the XML includes
>> any expression that contains a line break.
>>
>
> Then escape the expressions using CDATA or such... I'm sure it would be
> possible to make sure it's one line and rely on that. That's part of
> being machine readable, being able to rely on getting it at all without
> too much parsing magic...
>
>
>

Well, the right solution would actually be NOT to use CDATA but to
replace a literal linefeed with the XML numeric escape &#x0a; , but I
really don't think it's necessary.

The extraction tools will be simple whether or not we put everything on
one line.

Assuming we adopt Alvaro's suggestion of an <auto-explain> root, here's
how it would work without putting everything on one line:

{ echo "<explain-root>"; sed -n
'!<auto-explain>!,!</auto-explain>!p' logfile ; echo
"</explain-root>"; } > explain-plans.xml

Putting everything on one line, this becomes:

{ echo "<explain-root>"; sed -n '!<auto-explain>!p' logfile ; echo
"</explain-root>"; } > explain-plans.xml

Not very hard either way, is it?

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2009-08-12 16:08:11 Re: "Hot standby"?
Previous Message Cédric Villemain 2009-08-12 16:07:07 Re: expanding our usage of POSIX_FADVISE