Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uGub9-009oSq-37 for pgsql-general@arkaria.postgresql.org; Mon, 19 May 2025 07:07:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uGub8-00E8wR-5R for pgsql-general@arkaria.postgresql.org; Mon, 19 May 2025 07:07:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uGub7-00E8wJ-Pg for pgsql-general@lists.postgresql.org; Mon, 19 May 2025 07:07:41 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uGub4-002X2h-2z for pgsql-general@lists.postgresql.org; Mon, 19 May 2025 07:07:40 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id A18912C0093; Mon, 19 May 2025 09:07:36 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: pg_stat_statements has duplicate entries for the same query & queryId From: "Daniel Verite" To: "Jevon Cowell" Cc: pgsql-general@lists.postgresql.org In-Reply-To: Date: Mon, 19 May 2025 09:07:35 +0200 Message-Id: <2c2446a8-ec7e-4a91-b69d-62e70f1dc51c@manitou-mail.org> X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jevon Cowell wrote: > What I'm seeing is that for the same query *and* query id, > there are two rows with different statistics data *at the same time*. For > example one row can have 2 calls while another can have 4 That looks normal. The unicity to expect is on=20 (queryid, userid, dbid, toplevel). =46rom https://www.postgresql.org/docs/current/pgstatstatements.html : This view contains one row for each distinct combination of database ID, user ID, query ID and whether it's a top-level statement or not (up to the maximum number of distinct statements that the module can track) Best regards, --=20 Daniel V=E9rit=E9=20 https://postgresql.verite.pro/