Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxTag-0007BE-Ue for pgsql-admin@arkaria.postgresql.org; Fri, 12 May 2023 14:17:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pxTaf-0004jM-78 for pgsql-admin@arkaria.postgresql.org; Fri, 12 May 2023 14:17:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxTae-0004jD-Rk for pgsql-admin@lists.postgresql.org; Fri, 12 May 2023 14:17:48 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pxTaX-001wS5-Q0 for pgsql-admin@postgresql.org; Fri, 12 May 2023 14:17:47 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4QHrSc3MKpz9sQV; Fri, 12 May 2023 16:17:36 +0200 (CEST) Date: Fri, 12 May 2023 16:17:35 +0200 (CEST) From: Erik Wienhold To: kaido vaikla Cc: pgsql-admin@postgresql.org Message-ID: <1279536236.296763.1683901055904@office.mailbox.org> In-Reply-To: References: <472115375.225506.1683812791906@office.mailbox.org> Subject: Re: pg_stat_activity query_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4QHrSc3MKpz9sQV List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 12/05/2023 15:34 CEST kaido vaikla 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