Re: pg_stat_activity query_id

From: kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: pg_stat_activity query_id
Date: 2023-05-22 13:44:10
Message-ID: CA+427g_CsqGRJOb2QT66CoR-S9tC7snUFJ3tpN5COkE6f3gbKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I asked from pg jdbc community. Answer was :
"One thing to note is that the driver uses extended query protocol so the
queries are not identical.".
I don't know, is it this now key to understand this issue?
https://github.com/pgjdbc/pgjdbc/discussions/2902#discussioncomment-5917360
br
Kaido

On Fri, 12 May 2023 at 17:17, Erik Wienhold <ewie(at)ewie(dot)name> wrote:

> > On 12/05/2023 15:34 CEST kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com> wrote:
> >
> > I changed my query. "xact_start is not NULL" must show only active
> queries.
> > I see my own query with query_id, pwatch2 (
> https://github.com/cybertec-postgresql/pgwatch2)
> > queries with query_id, but application queries (PostgreSQL JDBC Driver)
> are
> > without query_id. Any idea why?
>
> As I wrote in my previous message, pg_catalog.pg_db_role_setting will tell
> you
> if compute_query_id is set for any user/database combination which
> overrides
> the system-wide default from postgresql.conf for new sessions.
>
> Your query results don't include usernames and databases. I assume the
> JDBC
> connections are with a different user or on a different database than the
> psql
> and pgwatch2 connections for which query_id is calculated.
>
> Could be that postgresql.conf sets compute_query_id=off and only the users
> that
> you used for psql and pgwatch2 have compute_query_id={on,auto}.
>
> Then there's also the chance that the applications using the JDBC driver
> set
> compute_query_id=off before sending queries. Doesn't explain however why
> this
> would also be the case for that one connection from IntelliJ IDEA (which I
> assume uses JDBC as well). I doubt that JDBC sets compute_query_id=off by
> default.
>
> My guess is user-specific session defaults.
>
> --
> Erik
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Phani Prathyush Somayajula 2023-05-22 14:07:31 RE: Partition By Range Without PrimaryKey : Postgresql Version 12.8 on AWS RDS
Previous Message Scott Ribe 2023-05-22 13:24:49 Re: Partition By Range Without PrimaryKey : Postgresql Version 12.8 on AWS RDS