explain refactoring v3

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: explain refactoring v3
Date: 2009-06-06 01:03:26
Message-ID: 603c8f070906051803nd4a9e3ekb72bcc379ad73f16@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Complete list of changes included in this patch:

- Remove unnecesary parameters nkeys, keycols, and qlabel from
show_sort_keys(), and completely unused parameter scanrelid from
show_scan_qual().
- Include the StringInfo buffer used as a staging area for EXPLAIN
output in the ExplainState object, rather than passing it around
separately.
- Refactor some duplicated logic out of
show_scan_qual()/show_upper_qual() into new function show_qual().
- Refactor various bits of duplicated logic from explain_outNode()
into new functions ExplainSubNodes(), ExplainMemberNodes(), and
ExplainScanTarget().
- For consistency with the naming of other functions in this module
and elsewhere, rename explain_outNode() to ExplainNode().
- Instead of having ExplainNode() indent all of the lines of its
output except the first, and making it the caller's responsibility to
properly indent the first line, make ExplainNode() indent the first
line too.
- Instead of having appendStringInfoSpaces() in ruleutils.c and
separate logic to do the same thing in multiple places in explain.c,
implement a single, efficient version of this logic in stringinfo.c.

I'm planning to submit one or more follow-on patches to implement
support for machine-readable EXPLAIN output, but it seems better to
have this part as a separate patch, since I think all of these changes
pretty much stand on their own, and this way it doesn't confuse the
issue of what is going on in the main patch. One of the important
parts of this tightening is that it substantially reduces the number
of different places that write directly to the output buffer, which is
good because essentially all of the remaining places will need to be
changed to support XML/JSON output.

...Robert

Attachment Content-Type Size
explain_refactor_v3.patch text/x-diff 36.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2009-06-06 01:27:19 Re: pg_migrator issue with contrib
Previous Message David Blewett 2009-06-06 00:39:09 Re: pg_migrator issue with contrib