Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE)) - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE))
Date
Msg-id 20221028225904.GJ16921@telsasoft.com
Whole thread Raw
In response to Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE))  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE))  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
On Tue, Oct 25, 2022 at 03:49:14PM +0200, Laurenz Albe wrote:
> On Thu, 2022-10-20 at 21:09 -0500, Justin Pryzby wrote:
> > Rebased.
> 
> I had a look at the patch set.

Thanks for looking

>   @@ -2288,6 +2288,7 @@ regression_main(int argc, char *argv[],
>           fputs("log_lock_waits = on\n", pg_conf);
>           fputs("log_temp_files = 128kB\n", pg_conf);
>           fputs("max_prepared_transactions = 2\n", pg_conf);
>   +       // fputs("explain_regress = yes\n", pg_conf);
>  
>           for (sl = temp_configs; sl != NULL; sl = sl->next)
>           {
> 
>   This code comment is a leftover and should go.

No - I was wondering whether the GUC should be specified by the
environment or by the file; I think it's better by file.  Then it also
needs to be in Cluster.pm.

> 0004, 0005, 0006, 0007: EXPLAIN (MACHINE)
> 
>   I think it is confusing that these are included in this patch set.
>   EXPLAIN (MACHINE OFF) is similar to "explain_regress = on", only it goes even further:
>   no query ID, no Heap Fetches, no Sort details, ...
>   Why not add this functionality to the GUC?

Good question, and one I've asked myself.

explain_regress affects pre-existing uses of explain in the regression
tests, aiming to simplify current (or maybe only future) uses.  And
is obviously used to allow enabling BUFFERS by default.

explain(MACHINE off) is mostly about allowing "explain ANALYZE" to be
used in regression tests.  Which, right now, is rare.  Maybe I shouldn't
include those patches until the earlier patches progress (or, maybe we
should just defer their discussion).

>   0005 suppresses "rows removed by filter", but how is that machine dependent?

It can vary with the number of parallel workers (see 13e8b2ee8), which
may not be "machine dependent" but the point of that patch is to allow
predictable output of EXPLAIN ANALYZE.  Maybe it needs a better name (or
maybe it should be folded into the first patch).

I'm not actually sure if this patch should try to address parallel
workers at all, or (if so) if what it's doing now is adequate.

> > BTW, I think it may be that the GUC should be marked PGDLLIMPORT ?
> 
> I think it is project policy to apply this mark wherever it is needed.  Do you think
> that third-party extensions might need to use this in C code?

Since v15 (8ec569479), the policy is:
| On Windows, export all the server's global variables using PGDLLIMPORT markers (Robert Haas)

I'm convinced now that's what's intended here.

> This is not enough.  The patch would have to update all the examples
> that use EXPLAIN ANALYZE.

Fair enough.  I've left a comment to handle this later if the patch
gains any traction and 001 is progressed.

-- 
Justin

Attachment

pgsql-hackers by date:

Previous
From: David Christensen
Date:
Subject: Re: [PATCHES] Post-special page storage TDE support
Next
From: Andres Freund
Date:
Subject: refactoring relation extension and BufferAlloc(), faster COPY