machine-readable explain output v2

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: machine-readable explain output v2
Date: 2009-06-18 03:43:30
Message-ID: 603c8f070906172043w6dba5b18x60e1cea76c44dba0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

OK, here's the second version of my machine-readable explain output
patches. Previous version here:

http://archives.postgresql.org/pgsql-hackers/2009-06/msg00867.php

To apply the current version, you will first need to apply
explain_refactor-v4.patch and explain_options-v3.patch.

http://archives.postgresql.org/pgsql-hackers/2009-06/msg00865.php
http://archives.postgresql.org/pgsql-hackers/2009-06/msg01094.php

As before, the infrastructure patch applies first and is separated
only for ease of reviewing. Based on feedback from the list, and
especially from Peter Eisentraut, I've made a number of changes and
improvements since the previous version of the patch:

- The XML format now uses <explain xmlns="..."> rather than <pgexplain>.

- The JSON format no longer quotes numeric arguments. I'm actually
not really that happy with this change; it seems likely that when
presented with an unquoted floating point number, most JSON parsers
will convert it to a native floating point value, throwing away the
information on how many significant digits were present in the
original. I think we should rethink this one. I don't know of a
programming language where there isn't an easy equivalent of
JavaScript's parseFloat() or C's atof().

- In XML or JSON formats, return the entire result as a single row,
rather than a series of rows that the caller is responsible for
concatenating. Also, in XML format, return the result as type xml,
rather than type text. If you want this to work even without
--with-libxml, you'll need to also apply do_tup_output_datum-v2.patch,
which you can find here:
http://archives.postgresql.org/pgsql-hackers/2009-06/msg00973.php

- Add a very simple regression test for EXPLAIN.

- Add documentation.

- Add a new GUC to contrib/auto_explain so that you can specify xml or
json output when using that module, as requested by Dave Page.

- Avoid using the "Trigger" tag to mean two different things; when
displaying trigger statistics, use "Trigger-Name" and
"Constraint-Name" instead of just "Trigger" and "Constraint", as
suggested by Andres Freund. Along the way, fix a bug in the JSON
format where {} was being used in place of [].

- When VERBOSE is specified, schema-qualify all tables and functions
scanned and alias-qualify all variable names appearing within quals.

- I also changed the behavior with regard to displaying trigger and
constraint names. Previously, the code displayed the trigger name
only if there was no constraint name. Now, the XML and JSON formats
always display both, and the text format displays both if VERBOSE is
specified.

Hope you all like it.

Thanks,

...Robert

Attachment Content-Type Size
explain_format_infrastructure-v2.patch text/x-diff 37.6 KB
explain_format-v2.patch text/x-diff 61.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-06-18 05:36:38 Re: Determining client_encoding from client locale
Previous Message tomas 2009-06-18 03:01:13 Re: machine-readable explain output