Re: Default gucs for EXPLAIN - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Default gucs for EXPLAIN
Date
Msg-id 20200523161226.GO4472@telsasoft.com
Whole thread Raw
In response to Default gucs for EXPLAIN  (Vik Fearing <vik@postgresfriends.org>)
Responses Re: Default gucs for EXPLAIN
List 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



pgsql-hackers by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: Extensions not dumped when --schema is used
Next
From: Dmitry Dolgov
Date:
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey