pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: kaido vaikla <kaido.vaikla@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_stat_activity query_id
Date: Fri, 12 May 2023 16:17:35 +0200 (CEST)
Message-ID: <1279536236.296763.1683901055904@office.mailbox.org> (raw)
In-Reply-To: <CA+427g-4EgyNBpQtZ60CKEryzq4p_ixv8xVBygFhMiNk5rAiUg@mail.gmail.com>
References: <CA+427g8qBArPuqwZOuYVhdoCQUsdbutR18fG7Gt7+3JunuHsjA@mail.gmail.com>
	<472115375.225506.1683812791906@office.mailbox.org>
	<CA+427g81dsn_5QyFr-zduuAYZ_0H4=xWOBnT4fT79pbzLCiwUg@mail.gmail.com>
	<CA+427g-4EgyNBpQtZ60CKEryzq4p_ixv8xVBygFhMiNk5rAiUg@mail.gmail.com>

> On 12/05/2023 15:34 CEST kaido vaikla <kaido.vaikla@gmail.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





view thread (10+ messages)  latest in thread

Message-ID: <1279536236.296763.1683901055904@office.mailbox.org>
Permalink:  ../1279536236.296763.1683901055904@office.mailbox.org/
Also on:    postgresql.org/message-id/1279536236.296763.1683901055904@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ewie@ewie.name, kaido.vaikla@gmail.com
  Subject: Re: pg_stat_activity query_id
  In-Reply-To: <1279536236.296763.1683901055904@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox