Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t17Mn-00EoOJ-Sf for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Oct 2024 16:59:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t17Mm-006NIO-4K for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Oct 2024 16:59:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t17Ml-006NG0-RD for pgsql-bugs@lists.postgresql.org; Wed, 16 Oct 2024 16:59:20 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t17Mi-001OBK-OJ for pgsql-bugs@postgresql.org; Wed, 16 Oct 2024 16:59:18 +0000 Received: from [192.168.11.2] (p4070206-ipxg13601funabasi.chiba.ocn.ne.jp [153.216.227.206]) by oss.nttdata.com (Postfix) with ESMTPSA id 1E6BD6064A; Thu, 17 Oct 2024 01:59:11 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: Date: Thu, 17 Oct 2024 01:59:10 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [BUGS] BUG #10123: Weird entries in pg_stat_activity Content-Language: en-US To: Andres Freund Cc: Fujii Masao , maxim.boguk@gmail.com, pgsql-bugs@postgresql.org References: <20140424101827.2714.39486@wrigleys.postgresql.org> <2153c106-8979-430d-ba86-34d35e565ab4@oss.nttdata.com> <20240704220316.srzqzkb7zgzh76xy@alap3.anarazel.de> From: Fujii Masao In-Reply-To: <20240704220316.srzqzkb7zgzh76xy@alap3.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024/07/05 7:03, Andres Freund wrote: > Calls to pgstat_report_activity() aren't exactly free. This substantially > increases the number of calls to it for common workloads. There got to be a > more targeted way of dealing with this. Yes. So, as an alternative approach, how about setting xact_start and query_start to NULL whenever the state is idle, since non-NULL values aren't expected in that case? This would prevent the weired pg_stat_activity entries I mentioned earlier, with minimal performance impact. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION