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 1lUWOU-00083A-DP for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 15:16:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUWOT-0002R5-9y for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 15:16:29 +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 1lUWOT-0002Qx-5D for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 15:16:29 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUWOQ-00060g-Bh for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 15:16:28 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lUWOO-00026X-Gb; Thu, 08 Apr 2021 11:16:24 -0400 Date: Thu, 8 Apr 2021 11:16:24 -0400 From: Bruce Momjian To: Julien Rouhaud Cc: Andres Freund , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Move pg_stat_statements query jumbling to core. Message-ID: <20210408151624.GA2439@momjian.us> References: <20210408051735.lfbdzun5zdlax5gd@alap3.anarazel.de> <20210408061102.xripofnfvqt7qcrg@nol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408061102.xripofnfvqt7qcrg@nol> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 8, 2021 at 02:11:02PM +0800, Julien Rouhaud wrote: > > oh, I think it's because parallel workers now have the queryid of the main > > query. Probably ignoring parallel workers in the executor end hook will fix > > the problem. I'll look at it as soon as I will be back home. > > That was indeed the problem. I think the best is to entirely ignore parallel > workers in pg_stat_statements, as done in attached patch, which fixes the > regression tests with force_parallel_mode = regress. > >From 45885bee58ab98c33b8e75edec13e08851523444 Mon Sep 17 00:00:00 2001 > From: Julien Rouhaud > Date: Thu, 8 Apr 2021 13:59:43 +0800 > Subject: [PATCH v1] Ignore parallel workers in pg_stat_statements. > > Oversight in 4f0b0966c8 which exposed queryid in parallel workers. Counters > are aggregated by the main backend process so parallel workers would report > duplicated activity, and could also report activity for the wrong entry as they > are only aware of the top level queryid. > > Author: Julien Rouhaud > Reported-by: Andres Freund > Discussion: https://postgr.es/m/20210408051735.lfbdzun5zdlax5gd@alap3.anarazel.de Patch applied. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.