Re: pg_stat_statements has duplicate entries for the same query & queryId

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Jevon Cowell" <jcowell(at)atlassian(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_stat_statements has duplicate entries for the same query & queryId
Date: 2025-05-19 07:07:35
Message-ID: 2c2446a8-ec7e-4a91-b69d-62e70f1dc51c@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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
(queryid, userid, dbid, toplevel).

From 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,
--
Daniel Vérité
https://postgresql.verite.pro/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Moreno Andreo 2025-05-19 08:14:16 Re: Logical replication, need to reclaim big disk space
Previous Message Ge Yuxiang 2025-05-19 05:03:02 Ge Yuxiang added you to the postgresql group