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 1lUNs9-0003pQ-6K for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 06:10:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUNs7-0007iQ-VZ for pgsql-committers@arkaria.postgresql.org; Thu, 08 Apr 2021 06:10:31 +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 1lUNs7-0007fX-NA for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 06:10:31 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lUNs5-0001bD-Dp for pgsql-committers@lists.postgresql.org; Thu, 08 Apr 2021 06:10:30 +0000 Received: by mail-pj1-x1029.google.com with SMTP id ha17so558720pjb.2 for ; Wed, 07 Apr 2021 23:10:29 -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:content-transfer-encoding:in-reply-to; bh=PxZBepJxJ1FAzjMFvwwwwBxeGHe4dgigPC7z7yeaoHE=; b=HOG9atUV3FxgjngJKuJfMBhmPzwjktLYUzvuMcbqmQdiA5sZsehBuNN4CYDFzfNG/J I8pOQBe21uPXAfpNVTP8EGoBLjI7/3s81cEvUnlGzccPHnKMNJHrOyaFmbZr/rgQBpfI tPIFYGaN1/sspX5qiSAviE+k5tjIojdWlxAmGrRyKORKqt8fbuGo1loiIXMUQ16xrLIm t1ZkZv69II4W15IcznJwyt3plaCeZ6/Ehey2TALyMSyNHZTkVVHBqATEtc6kfVFh3NKU qhu5dZ07pi80iQpanP6X6mOb2eNwHUFeyAD1OZzlkjxAkXvf6ujxX+Jee3d28F6FiYAB 2srw== 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:content-transfer-encoding :in-reply-to; bh=PxZBepJxJ1FAzjMFvwwwwBxeGHe4dgigPC7z7yeaoHE=; b=czXa8NbvUx1Zh2dNCtFdUKgx8dHCD0842f7CFuaLdlrFLQylmic3mnCSYb4KdF13C5 dzuarUH9dou8TZ15f0DYWn1gNxL6kP9A0ajz0XFhA9VzTgX/smQb2CrCA/UGjLrXWzzp +59/i+rgmY4jMfU5jKgye1Tz7sr6BbxY1F8nARmzafgjY/qezeEH1oQAKkhvXo1EljFy NTMC5fAy+D/CaknqvSiVWNRPlfK3eh2bFpGHrK5fxL4k4mz4jUXBbpbjYq1CMBano0sU JElosgBvKxumPrWROPzODmzsBv01xfrJvz/5rHtmkL+mryxKAl3CIsK2qyl0R/Z2bsXu i/kQ== X-Gm-Message-State: AOAM533UzUb4TNzC+Y497XaMh6sHa4dzvh92rpJ1llwrI44MwgWG654y yVay0VAu4fGWq26FBuMhwUs= X-Google-Smtp-Source: ABdhPJx+iwNq2uTQoms70/sCcbFozoLG42tfwoiUzLMXnY+9Kip1VMxqkbEIlETot2piDHkb1eyY+Q== X-Received: by 2002:a17:90a:b00c:: with SMTP id x12mr750210pjq.216.1617862228397; Wed, 07 Apr 2021 23:10:28 -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 e8sm672911pfc.215.2021.04.07.23.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 23:10:27 -0700 (PDT) Date: Thu, 8 Apr 2021 14:11:02 +0800 From: Julien Rouhaud To: Andres Freund Cc: Bruce Momjian , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Move pg_stat_statements query jumbling to core. Message-ID: <20210408061102.xripofnfvqt7qcrg@nol> References: <20210408051735.lfbdzun5zdlax5gd@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vjzg4yjaln5awrod" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vjzg4yjaln5awrod Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Apr 08, 2021 at 01:22:49PM +0800, Julien Rouhaud wrote: > Le jeu. 8 avr. 2021 à 13:17, Andres Freund a écrit : > > > > > This - or something in the vicinity - seems to break running the > > regression tests with force_parallel_mode=regress. There's lots of > > differences like > > > > SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE > > "C"; > > query > > | calls | rows > > > > ------------------------------------------------------------------------------+-------+------ > > SELECT (i + $2 + $3)::INTEGER > > | 2 | 2 > > SELECT (i + $2)::INTEGER LIMIT $3 > > | 2 | 2 > > - SELECT PLUS_ONE($1) > > | 2 | 2 > > - SELECT PLUS_TWO($1) > > | 2 | 2 > > - SELECT pg_stat_statements_reset() > > | 1 | 1 > > + SELECT PLUS_ONE($1) > > | 4 | 4 > > + SELECT PLUS_TWO($1) > > | 4 | 4 > > + SELECT pg_stat_statements_reset(); > > 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. --vjzg4yjaln5awrod Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Ignore-parallel-workers-in-pg_stat_statements.patch"