Re: pg_stat_activity.query_id <-> pg_stat_statements.queryid

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stat_activity.query_id <-> pg_stat_statements.queryid
Date: 2024-02-15 15:04:02
Message-ID: icwgikteyqesoxwrvr2bjfpwbrhp2k57w7qc5spgnqk4vpao2n@h7oi67oe5332
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Thu, Feb 15, 2024 at 10:52:42AM +0000, Daniel Westermann (DWE) wrote:
>
> quick question: What would be the cases for a query_id in pg_stat_activity
> not showing up in pg_stat_statements.queryid assuming pg_stat_statements.max
> is not yet reached?

Well, first the query_id in pg_stat_activity is only the query_id of top-level
statements, that may still be running while pg_stat_statements only show
statistics of already executed statements (top level only or not depends on
config).

You may also be running some utility statements, which will display a query_id
in pg_stat_activity while pg_stat_statements will ignore them by default IIRC.

No other idea apart from that.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-02-15 16:16:50 Re: How to do faster DML
Previous Message Daniel Westermann (DWE) 2024-02-15 10:52:42 pg_stat_activity.query_id <-> pg_stat_statements.queryid