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 1lURAg-0003bX-Cz for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 09:41:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lURAf-0005zG-Av for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 09:41:53 +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 1lURAf-0005z9-2z for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 09:41:53 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lURAd-0003mY-8A for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 09:41:52 +0000 Received: by mail-pl1-x633.google.com with SMTP id 7so736026plb.7 for ; Thu, 08 Apr 2021 02:41:50 -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=WeDxkwrd1JnGf2FD6GDvB6D1LZT1Pj14hgbQBDCQNjY=; b=D61wjzv6JwBFpKL+ZcEmbtEf8+OpmG9CuH/lCj1he4w6ZBCnjRdWOStM19HLam93vU XB531/MMc3TdCJuQKe6zKln2pGyvR8Pn5BilG+RIMuf2ozTnpsAnvynHH+w0zB6cHG4/ i+ZRx2en6hD0jJzCFe5txuzLkZp2TZNtk9vtmSKXgFb+uHMZ2Iod4cfVG2RHnaukhGQ1 BMcDE1oq45MZckHLHxaCJxTY5G269DgvAE2flcz7yoSIAsfTqTfQcHXr6skKgYKHtbj2 7Fu5UsDdUA6B6LsZ4HE4EJcSXnORN843gvrfiiYTDBramZhVBwTCnTzzyNnnugEZ/brP Kr6g== 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=WeDxkwrd1JnGf2FD6GDvB6D1LZT1Pj14hgbQBDCQNjY=; b=tvGzSLcA/igv6SFjBpM80gozfUb9MiESrHv/WIsO+sjE/bkYn6ReZfBjqeAxUVDM4a Q+PU5E0BiCtvwhbEyOmCJLztD53MqFsTXcVBTBbIOwxoKnTgMOBu5G4xLOrwBLQzOa93 rcMYmOjoEEzoxD+r30oXXK43FYDDtj1nq1Ocw8DJhMZlsQh29fZWMgrqullvRoUpWT5/ 51sFenMBHKLlABOsaa20j/+U9xlI2aSLecaecZ4xdhbKrUMpwjLWemHz4DmFW27uNmrp bcvvrO/gcPYSkPOxO5YwkgnAcf0/7mRkQkEavVmSF0JfnO6R4Ch08BkdeF0Nrzqik3oq ohLQ== X-Gm-Message-State: AOAM531kwMLmqKRAUmhKsLLdru0mLrIslABRvONlUUXIIWTfdN1B4GPp vSjdmMLric4RjdolpYVGg4A= X-Google-Smtp-Source: ABdhPJxpZt0bc8baIapz/VIS9gtRkO/KVelNfBGlUm2rKLoRaasVNu+V5NiJlIZuLrF3P3Le1CJdWw== X-Received: by 2002:a17:90b:120a:: with SMTP id gl10mr7465042pjb.212.1617874908868; Thu, 08 Apr 2021 02:41:48 -0700 (PDT) Received: from nol (2001-b011-0008-9647-4c71-2a6f-a895-f450.dynamic-ip6.hinet.net. [2001:b011:8:9647:4c71:2a6f:a895:f450]) by smtp.gmail.com with ESMTPSA id d75sm7465013pfd.100.2021.04.08.02.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 02:41:48 -0700 (PDT) Date: Thu, 8 Apr 2021 17:42:21 +0800 From: Julien Rouhaud To: Amit Kapila Cc: Andres Freund , Bruce Momjian , pgsql-committers Subject: Re: pgsql: Move pg_stat_statements query jumbling to core. Message-ID: <20210408094221.s7nyhqe7h22htr7n@nol> References: <20210408051735.lfbdzun5zdlax5gd@alap3.anarazel.de> <20210408061102.xripofnfvqt7qcrg@nol> <20210408064919.bxqnzpi2ctt3rfzg@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: Archived-At: Precedence: bulk On Thu, Apr 08, 2021 at 02:52:26PM +0530, Amit Kapila wrote: > > Yeah, we do pass instrumentation flags from leader to worker but not > the one allocated via pg_stat_staments (pgss_ExecutorStart {... > queryDesc->totaltime ...}. Ah indeed, I now remember that problem that I had to deal with in some extensions [1]. For the record this was initially raised by Tomas in [2], but unfortunately that thread got forgotten and probably all third-party extensions ended up allocating some shmem for their need. > However, I guess prior to this patch those > were anyway not allocated separately because queryid was not passed to > workers. So, I think you are right it shouldn't change the previous > behavior. I think that previously parallel workers always added the required instrumentation if pg_stat_statements is loaded, but InstrEndLoop() wasn't called by pgss itself so I'm not sure what happens in that case. > I am not completely sure but it seems we were not accumulating the > instrumentation info by workers required by pg_stat_statements neither > before this patch nor after but I might be missing something. Same here. I'll try to dig to get an answer, but it seems to me that it's an old bug and not really a new one. It would probably still make sense to add an open item for this in pg14 as it's evidently more broken that before. [1]: https://github.com/powa-team/pg_qualstats/issues/9 [2]: https://www.postgresql.org/message-id/3f62f24e-51b3-175c-9222-95f25fd2a9d6@2ndquadrant.com