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 1jjLDB-0007ih-Nb for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jun 2020 11:17: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 1jjLCe-00039c-TY for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jun 2020 11:17:00 +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 1jjLCe-00039V-NL for pgsql-bugs@lists.postgresql.org; Thu, 11 Jun 2020 11:17:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjLCX-0002TR-PK for pgsql-bugs@postgresql.org; Thu, 11 Jun 2020 11:17:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05BBGmPN198018; Thu, 11 Jun 2020 07:16:49 -0400 From: Tom Lane To: Julien Rouhaud cc: legrand legrand , "pgsql-bugs@postgresql.org" Subject: Re: pg_stat_statements: duplicated external query texts with MSY2 In-reply-to: References: Comments: In-reply-to Julien Rouhaud message dated "Thu, 11 Jun 2020 09:21:28 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <198016.1591874208.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 11 Jun 2020 07:16:48 -0400 Message-ID: <198017.1591874208@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Julien Rouhaud writes: > On Mon, Jun 8, 2020 at 11:28 PM legrand legrand > wrote: >> pgbench -i postgres >> pgbench -c20 -t5 postgres >> generates the attached pgss_query_texts.stat, >> where "BEGIN" and "UPDATE pgbench_accounts SET abalance =3D abalance + = $1 WHERE aid =3D $2" >> appears 20 times ... > Is the duplication only in the query text file? Looking at the code > the query text part is stored holding a shared lwlock, so it seems > like an expected behavior (less overhead but might store duplicated > query text) I agree, this looks like operating-as-designed: different processes can store the same query text and only later discover that they were creating duplicate hash table entries. It's a bit surprising that the duplication would be reproducible, but it just depends on timing. Maybe this is telling us something about how scheduling works under MSYS2. regards, tom lane