Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGTCv-0002GB-CC for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jul 2022 22:39:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oGTCu-0000qR-7B for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jul 2022 22:39:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGTCt-0000qI-RV for pgsql-hackers@lists.postgresql.org; Tue, 26 Jul 2022 22:39:15 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oGTCq-0003IR-Qv for pgsql-hackers@lists.postgresql.org; Tue, 26 Jul 2022 22:39:15 +0000 Received: by mail-ej1-x634.google.com with SMTP id fy29so28486303ejc.12 for ; Tue, 26 Jul 2022 15:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MRaAchKjOcxJuW3zjj+Tu3eaHb4/SxtYLx0WFZR+UBk=; b=hZQlwXqycx1ihxvl8ntVo29wVimfSgEYtRQvnex0fWlJAtlqDMRkf6wHM8yA4rTUjQ pqsMcf/ln2pHzBH/CK5OY7CGVxMcTu31sDhIdWknqs093aq6vGeydpMULYFV/8sd0Rzz qZ9BDk5wrKVp5YP1wO2g+Ji8WO4biBAMUg/edCTYxGcRRo6cdPsE1IdWkTAu0emGEJM/ AdfyJZK+vBHhItWMYCXGVYezQORqG2t3jFWZnbiRLfWyojwB5GcMzEpThRKusCOsU6cO 8liOFmTeTQ5IbaCZKded+6XphQQeuofO3y1D4vp5KhaMjZg2scBy1L+2spma+Y1V3c1S +ISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MRaAchKjOcxJuW3zjj+Tu3eaHb4/SxtYLx0WFZR+UBk=; b=zoXoAZZib+IGQrhGFFL6dJdO37oiauRa9iijeNDj63/CxGcSKPJdc3/4vZKKjnXt/Y q9GUIh1UpFB+30+FniwPh19fzmaMaDl6GSCmWb2A7Y6Tbehzn+4GtykUgyfU/s+CHuPr aXcxHkvGUWUs6XRtuVYsxnYKEkkqnLpPh9fMqS7+Bo6bZVXKcpp8q7n2aB1flM/+3wvu hF13v7rwjFF0G+4EcwLJ/X3gM2mdOt7kGUhd2aXoyMakciSkAwMeVdt3j/UCHc/MJOtP BM6+tAwTgBHm+OdON2UnoimV6/yGoO05nismDH1dcTwevLJueAVX02tzeaMdUNYR3qFt MvEw== X-Gm-Message-State: AJIora/4TgZuE8RG+J/r+VcTd58GHX4phPj8X81uDRIHysTCj2f2GLmC 55xAJ3pZOHxBCUbEZbu0+XjFHSz+SNe1JipJ2KU= X-Google-Smtp-Source: AGRyM1sGNmXhcRfXhTwUPQCh+TOQALuUOo0dvqlwjKi53V7wzCagaEe/wXQ8aFg3arcd3fC81kclnbkdxpswrV7sAlc= X-Received: by 2002:a17:907:3e21:b0:72f:87c:efeb with SMTP id hp33-20020a1709073e2100b0072f087cefebmr15661102ejc.528.1658875150795; Tue, 26 Jul 2022 15:39:10 -0700 (PDT) MIME-Version: 1.0 References: <20211115190954.GO17618@telsasoft.com> <20211202005820.GJ17618@telsasoft.com> <20220124173548.GV23027@telsasoft.com> In-Reply-To: <20220124173548.GV23027@telsasoft.com> From: "David G. Johnston" Date: Tue, 26 Jul 2022 15:38:53 -0700 Message-ID: Subject: Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE)) To: Justin Pryzby Cc: Nikolay Samokhvalov , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="00000000000017091c05e4bcf883" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000017091c05e4bcf883 Content-Type: text/plain; charset="UTF-8" On Mon, Jan 24, 2022 at 9:54 AM Justin Pryzby wrote: > I'm renaming this thread for better visibility, since buffers is a small, > optional part of the patches I sent. > > I made a CF entry here. > https://commitfest.postgresql.org/36/3409/ > > On Wed, Dec 01, 2021 at 06:58:20PM -0600, Justin Pryzby wrote: > > On Mon, Nov 15, 2021 at 01:09:54PM -0600, Justin Pryzby wrote: > > > Some time ago, I had a few relevant patches: > > > 1) add explain(REGRESS) which is shorthand for (BUFFERS OFF, TIMING > OFF, COSTS OFF, SUMMARY OFF) > > > 2) add explain(MACHINE) which elides machine-specific output from > explain; > > > for example, Heap Fetches, sort spaceUsed, hash nbuckets, and > tidbitmap stuff. > > > > > > > https://www.postgresql.org/message-id/flat/20200306213310.GM684@telsasoft.com > > > > The attached patch series now looks like this (some minor patches are not > > included in this list): > > > > 1. add GUC explain_regress, which disables TIMING, SUMMARY, COSTS; > > > 2. enable explain(BUFFERS) by default (but disabled by explain_regress); > +1 > > 3. Add explain(MACHINE) - which is disabled by explain_regress. > > This elides various machine-specific output like Memory and Disk use. > > Maybe it should be called something else like "QUIET" or > "VERBOSE_MINUS_1" > > or ?? > INCIDENTALS ? Aside from being 4 syllables and, for me at least, a pain to remember how to spell, it seems to fit. RUNTIME is probably easier, and we just need to point out the difficulty in naming things since actual rows is still shown, and timings have their own independent option. > > > The regression tests now automatically run with explain_regress=on, > which is > > shorthand for TIMING OFF, SUMMARY OFF, COSTS OFF, and then BUFFERS OFF. > > > > There's a further option called explain(MACHINE) which can be disabled > to hide > > portions of the output that are unstable, like Memory/Disk/Batches/ > > Heap Fetches/Heap Blocks. This allows "explain analyze" to be used more > easily > > in regression tests, and simplifies some existing tests that currently > use > > plpgsql functions to filter the output. But it doesn't handle all the > > variations from parallel workers. > > > > (3) is optional, but simplifies some regression tests. The patch series > could > > be rephrased with (3) first. > I like the idea of encapsulating the logic about what to show into the generation code instead of a post-processing routine. I don't see any particular ordering of the three changes being most clear. > > > Unfortunately, "COSTS OFF" breaks postgres_fdw remote_estimate. If > specifying > > "COSTS ON" in postgres_fdw.c is considered to be a poor fix Given that we have version tests scattered throughout the postgres_fdw.c code I'd say protect it with version >= 9.0 and call it good. But I'm assuming that we are somehow also sending over the GUC to the remote server (which will be v16+) but I am unsure why that would be the case. I'm done code reading for now so I'm leaving this an open request/question. , then I suppose > > this patch series could do as suggested and enable buffers by default > only when > > ANALYZE is specified. Then postgres_fdw is not affected, and the > > explain_regress GUC is optional: instead, we'd need to specify BUFFERS > OFF in > > ~100 regression tests which use EXPLAIN ANALYZE. I'm not following the transition from the prior sentences about COSTS to this one regarding BUFFERS. (3) still seems useful on its > > own. > It is an orthogonal feature with a different section of our user base being catered to, so I'd agree by default. Patch Review Comments: The following change in the machine commit seems out-of-place; are we fixing a bug here? explain.c: /* Show buffer usage in planning */ - if (bufusage) + if (bufusage && es->buffers) Typo (trailing comment // without comment): ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es); // I did a pretty thorough look-through of the locations of the various changes and everything seems consistent with the established code in this area (took me a bit to get to the level of comprehension though). Whether there may be something missing I'm less able to judge.