Re: Default gucs for EXPLAIN

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Vik Fearing <vik(at)postgresfriends(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Default gucs for EXPLAIN
Date: 2020-05-23 16:12:26
Message-ID: 20200523161226.GO4472@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 23, 2020 at 11:14:05AM +0200, Vik Fearing wrote:
> Here is a patch to provide default gucs for EXPLAIN options.
>
> I have two goals with this patch. The first is that I personally
> *always* want BUFFERS turned on, so this would allow me to do it without
> typing it every time.
>
> The second is it would make it easier to change the actual default for
> settings if we choose to do so because users would be able to switch it
> back if they prefer.
>
> The patch is based off of a995b371ae.

The patch adds new GUCs for each explain() option.

Would it be better to make a GUC called default_explain_options which might say
"COSTS ON, ANALYZE ON, VERBOSE OFF, BUFFERS TBD, FORMAT TEXT, ..."
..and parsed using the same thing that parses the existing options (which would
need to be factored out of ExplainQuery()).

Do we really want default_explain_analyze ?
It sounds like bad news that EXPLAIN DELETE might or might not remove rows
depending on the state of a variable.

I think this should be split into two patches:
One to make the default explain options configurable, and a separate patch to
change the defaults.

+ /* Set defaults. */
+ es->analyze = default_explain_analyze;
+ es->buffers = default_explain_buffers;
+ es->costs = default_explain_costs;
...

I think you could avoid eight booleans and nine DefElems by making
default_explain_* a struct, maybe ExplainState. Maybe all the defaults should
just be handled in NewExplainState() ?

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2020-05-23 16:16:34 Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
Previous Message Guillaume Lelarge 2020-05-23 12:53:53 Re: Extensions not dumped when --schema is used