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 1jKLm3-0006Xj-4t for pgsql-committers@arkaria.postgresql.org; Fri, 03 Apr 2020 12:50:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKLm1-0000Ny-UH for pgsql-committers@arkaria.postgresql.org; Fri, 03 Apr 2020 12:50:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKLm1-0000Nj-Mt for pgsql-committers@lists.postgresql.org; Fri, 03 Apr 2020 12:50:13 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jKLlz-0002nF-EX for pgsql-committers@lists.postgresql.org; Fri, 03 Apr 2020 12:50:12 +0000 Received: by mail-wm1-x344.google.com with SMTP id z14so2047428wmf.0 for ; Fri, 03 Apr 2020 05:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dsyEP7nddvRxvfG9S/+3/Jl/5tzDUFzAvD8P9DWqrNc=; b=PIG2myD8FSkwphYybd3ou0lz+0GjogZSsedym6H1+RWd9e4+KUJXu9c2foVuxKvnQM k6S7UxIwe8uV3w7qzgk/BW8BgKVJOpcqMr/W4VhEVHl4Tp1vxjfExnJ4yM/oT2++VgRz mZtEFCmtZ4OvXFN2BZYJLOvj+veafsJ8LokAIOWgdF+CZyR0c9YED4mK08O/WkKqA38m 1tHgk+6AST26tPYKv+mBgVkqTKB1myjszO00Ri4wK9Mmw6usSARf4NutWF/SAI02yBNp Q82ClRcPzvVX0kTZiUOLXB4M5wSe0KnOzm4wK+BmdARbZeKEMZ9kEmN2sKq9UYgF5hHc r59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dsyEP7nddvRxvfG9S/+3/Jl/5tzDUFzAvD8P9DWqrNc=; b=WOaF/dLB7hv2+dCZXok0FhQ4TVIHz2uZlevVivrQRLqSx4uiI2v1gOMbOR2mX6x8DX vOn/7QE32tmirQkA1RUBgLygbRufpWyu1O0uGNxJddUdTck+Gc7JWUfBuk1mf+Y6S61Y JRKGA3dmfCvU9CQvoOMkXIbb5MKXyvpar1CA236SGK+jROp2x50NPHolZ/TYzsjhqiCr pxGqvNVo597ep6vr+0sF7kFCXj0Lov00g4XH4WzZr7n1hQ98HsP+SelTiGazZwAIhKpy F81NBQ8TSdIpQn8haXIVOQGBxHd2fEOuPsink+upPb278HSSthgnZfxD3rRNdK7yBKJm czzg== X-Gm-Message-State: AGi0PubS9gaLmxZfYc/glVVDyPNqMGJknuNQW0sJQwFH1d4XhftCeq8z t+VKraYpJG9w0ErdPexrX7o= X-Google-Smtp-Source: APiQypIJcgfcbfYdoAaKDXfgIBhvNdu72jnjM1bNe8EEDzSSXGL67ZcUCwulWJ7bhzqMG7bv3dh5hw== X-Received: by 2002:a1c:4486:: with SMTP id r128mr8858758wma.32.1585918209900; Fri, 03 Apr 2020 05:50:09 -0700 (PDT) Received: from nol ([2a01:e0a:c:bcf0:dbc8:f7e9:89ae:5cd7]) by smtp.gmail.com with ESMTPSA id x206sm11398242wmg.17.2020.04.03.05.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:50:08 -0700 (PDT) Date: Fri, 3 Apr 2020 14:49:43 +0200 From: Julien Rouhaud To: Fujii Masao Cc: Tom Lane , Michael Paquier , Fujii Masao , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Include information on buffer usage during planning phase, in EX Message-ID: <20200403124943.4p4drqwujifi4kv6@nol> References: <20200403025751.GB1759@paquier.xyz> <0fa34bc8-479e-61e8-94c0-9cdbc34ea0bb@oss.nttdata.com> <23095.1585884653@sss.pgh.pa.us> <4ecdae9c-fa0b-17b6-9166-0a45c396da22@oss.nttdata.com> <20200403074347.GA1206@nol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Apr 03, 2020 at 09:27:38PM +0900, Fujii Masao wrote: > > > On 2020/04/03 16:43, Julien Rouhaud wrote: > > On Fri, Apr 03, 2020 at 03:24:41PM +0900, Fujii Masao wrote: > > > > > > > > > On 2020/04/03 12:30, Tom Lane wrote: > > > > Fujii Masao writes: > > > > > On 2020/04/03 11:58, Michael Paquier wrote: > > > > > > prion did not like that: > > > > > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2020-04-03%2002%3A33%3A13 > > > > > > > > dory failed as well. The problem is that in text mode, a Buffers line > > > > won't appear at all if there were zero buffer accesses. I don't think > > > > we really want to change that, > > > > > > Yes. > > > > > > > so probably the thing to do is adapt > > > > the filter functions in explain.sql so that they suppress Buffers lines > > > > altogether in text output. Kind of annoying, but ... > > > > > > I'm thinking to suppress only Buffers line just after Planning Time line, > > > by applying something like the following changes to explain_filter(). > > > Thought? > > > > > > +1, that's a better workaround. > > > > > > > > > > declare > > > ln text; > > > + ignore_output boolean; > > > begin > > > for ln in execute $1 > > > loop > > > + IF ignore_output THEN > > > + ignore_output := false; > > > + CONTINUE WHEN (ln ~~ ' Buffers: %'); > > > + END IF; > > > + ignore_output := ln ~~ 'Planning Time: %'; > > > -- Replace any numeric word with just 'N' > > > ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); > > > -- In sort output, the above won't match units-suffixed numbers > > > > > > I'm not sure of what's plpgsql behavior here, but it's probably better to > > initialize ignore_output to false. > > Thanks for the review! Yes, that's necessary. > > > Nitpicking, but I think that > > planning_time_found, or something similar, would be better here. > > Yeah, that sounds better. > > Attached is the updated version of the patch. Thanks Fuji-san! Just to be extra safe I locally added an extra RAISE notice '%', ln; before the continue and I confirm that this is only filtering the intended lines. Minor thinko: + -- test output stable. This is necessary because whether text-mode + -- buffers output for the planning appears or not varies depending + -- on the compile option. It appears if the server is built with + -- -DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE, + -- but not otherwise. those lines begin with a leading tabulation while the rest of the sql file only contains space indentation. Other than that it all looks good to me.