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

From Andrew Dunstan
Subject Re: machine-readable explain output v4
Date
Msg-id 4A82E8BD.4050706@dunslane.net
Whole thread Raw
In response to Re: machine-readable explain output v4  (Csaba Nagy <nagy@ecircle-ag.com>)
Responses Re: machine-readable explain output v4
List 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 
 , 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





pgsql-hackers by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: expanding our usage of POSIX_FADVISE
Next
From: Bruce Momjian
Date:
Subject: Re: "Hot standby"?