Re: Parsing output of EXPLAIN command in PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Αναστάσιος Αρβανίτης <tasosarvanitis(at)yahoo(dot)gr>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parsing output of EXPLAIN command in PostgreSQL
Date: 2011-11-10 21:59:29
Message-ID: 17247.1320962369@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 11/10/2011 04:29 PM, Robert Haas wrote:
>> 2011/11/10 <tasosarvanitis(at)yahoo(dot)gr>:
>>> Is there any other solution I am not aware of?

>> Not that I know of. I think pgAdmin can parse the EXPLAIN output,
>> too, but that's in C++.

> Pg--Explain is extremely well written, and should be easily translatable
> to Java if you really need to. The whole thing is less than 2000 lines,
> and a large part of that is comments.

Nonetheless, it's solving the wrong problem. Any program that is being
written today to read EXPLAIN output should be written to read one of
the machine-readable formats. If you insist on reading the text format,
don't be surprised when (not if) it breaks in future releases, and don't
expect any sympathy from these quarters.

It really shouldn't be that difficult to come by pre-fab code to read
at least one of XML, JSON, or YAML into a suitable data structure.

Now, if you're looking for something that "understands" the resulting
data structure in more than a superficial fashion, that's a different
question. But you'd need to get a lot more specific about what you
need it to do.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-10 22:04:22 Re: LOCK_DEBUG is busted
Previous Message Kevin Grittner 2011-11-10 21:54:12 Re: const correctness