Rationalizing EXPLAIN VERBOSE output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Rationalizing EXPLAIN VERBOSE output
Date: 2002-03-09 19:09:21
Message-ID: 9125.1015700961@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Now that Bruce has done some work on rationalizing elog() output, seems
like we ought to take another look at EXPLAIN VERBOSE. Currently, that
command does this:

1. A non-pretty-printed plan dump (nodeToString output) is sent to
elog(INFO). Formerly that always output to both postmaster log and
client, but now it'll typically go only to the client.

2. The short-form output (same as non-VERBOSE EXPLAIN) is sent to
elog(INFO). See above.

3. The pretty-printed plan dump is sent to postmaster stdout.

Now postmaster stdout is just about the least good destination we
could possibly use. It may well end up in the bit bucket (if someone is
only saving stderr output, and/or is using syslog logging instead of
stderr). In any case it's not necessarily an easy place for the client
to get at.

Also, I find the non-pretty-printed dump format damn near unreadable,
although I have seen comments suggesting that there are some people who
actually like it. I don't see the point of giving it pride of place on
the client's terminal.

What I would suggest is that EXPLAIN VERBOSE ought to emit either
non-pretty-print or pretty-print dump format, not both (probably control
this with debug_pretty_print or another newly-invented GUC parameter;
IMHO the factory default should be pretty-printing). Furthermore, the
output should go to elog(INFO) in either case. This will take some work
to make the prettyprinter capable of that, but it's not a big job.
(A side effect of this is that pprint dumps logged by the
debug_print_plan and so forth options could go through elog as well,
which they don't now.)

A disadvantage of elog(INFO) output for pretty-printed plans is that
AFAIK psql doesn't currently have any way of capturing NOTICE output
into a file. I find it much better to look at pretty-printed dumps
in Emacs than on a terminal window, mainly because Emac's M-C-f and
M-C-b commands understand the nesting structure so it's easy to move
around in the dump with them. How hard would it be to get psql to
send notice output into a \g file?

Comments? In particular, should EXPLAIN use the existing
debug_pretty_print GUC variable, or have its own?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-03-09 22:26:25 Re: Small fix for _equalValue()
Previous Message Tom Lane 2002-03-09 18:38:01 Re: Error in executing user defined function