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.96) (envelope-from ) id 1w7VL1-005Nrn-1Y for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 09:24:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7VKz-009AAL-1t for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 09:24:42 +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.96) (envelope-from ) id 1w7VKz-009AAD-0k for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 09:24:41 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7VKw-000000029HX-3Ahd for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 09:24:41 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-482f454be5bso61552955e9.0 for ; Tue, 31 Mar 2026 02:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774949078; x=1775553878; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=m00OidQzL8oaMwZFK5nd0JK1m0lSdWvSPv6QilqcHLw=; b=g7ByFgJZJSGb2B1ZvABPD98v0u/4MFA75q9pqz0Ijn7bD9OVSbcaiQsnTO1MBrb7Ij vRnldQ1hQLhgD9KlbG4wIiu/vtclGh69B/BTjPKZUcUXitQ401XnzHzFuUv22YjMkl8B 5G9P1we9XO9MWGoihnxVB1/326p90kOQduh5B7k4159DIRxEZkCeMwCLbvQz6kHbXZHP VqdwhzkK93vWcY2D7Bun1ppLLag/Czday68J1HVxBYBavgT+JyM73wBn8PxpgTtmvkqq nqVmj/wAJZC/6ZeNUqtRZxvurwOyeVRf9jlytReFNfB8yD/rkDoS84yh4rixETWIT+17 XLcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774949078; x=1775553878; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=m00OidQzL8oaMwZFK5nd0JK1m0lSdWvSPv6QilqcHLw=; b=opCOpY7Xe3T+LFjv8nBgf5iOM3U8MbNaPdSOUwGYCAd+WK7ax36cL7OgFeIKOisSCx CkGiIJXyU+1ZA16MrwIYLvY4/7TaxJxtSMeLeECNIKHsW0D/t2UhtdH8y33jPEbtCBmo mIW2KI+66LuYeuyAlkNeiEAqEMbmPLRZOYZBgdPu9bX7p5ZeGKwv9/PJYuDIxO09WcyR DDqdihvod3tH0jnL986dQM2I807ocYu3GQYn2TIixjOwjvQgemMrlpDXGXxOOB3CWs3v ODe13zpr41ZWon75+E+aKWCjYGmYEcEwQh36APffEpkxYl0cRDvgwzH4AtoHwZgRyDfE rkng== X-Gm-Message-State: AOJu0YyPuHv/YfVmGW7QEl0flgVfEdHHTiNdyO9Bh2iMwKamBFdh6HRm jufN8N+gWtQdcIX/4ikNyCKyPsRiSlVVFQ7adPHXtzV1+iIiU42LRxpGaqiVrQ== X-Gm-Gg: ATEYQzyU6wPbxvv5Z8Fxb4+Tk4pksRvm6xqtnfKrkB2h2q2KSUFZwpOwdBCx0N8pZ77 Egy4wkdKWtUmFww4P/huBSUKCx2sHW+rvkXerjpAlLT9+S3AqU0fnng4jIg24B245Be8AHzv5nH zQav//hkzzz593M8aa24R280tIP6/zT8RiwxtgSa4O1E3QmItb+8xPJQcJhN/Ji7no7etUHXJ7j v5MiqNgULNFUV9N7tOCOcV61dn3NFSr+qlQjrxpLTLfFov1F1Xdz8tHLEDxxOgvb/YizyTcmyyE uV+sPvmx03FK9c0PzsJTMWTwW/feI7V4lRHeW6FpOBSudnb1oi7mjE3XeMfTx0nnWqXKcDw1kK9 UczF87w/hMF+hU0HfYeykZyp0TID5PRicvAYh3WiD5ygWxSNMD/+jWqQMz/lC/xOnigBehW8y3G yTSHf+xTN33KFLXRRYndQ00XUzovSztA7BXpoULR6u0q/7U7dxLON+VQpp+IaCW7+a0wCTFJFTX PGfLTJnNi4VY6X11GMsLcXd55k7cRRT8aooPHt5p4eKD+QsVnEYFCtp3A== X-Received: by 2002:a05:600c:1986:b0:486:faa8:9e4 with SMTP id 5b1f17b1804b1-488783a6913mr42546695e9.12.1774949077500; Tue, 31 Mar 2026 02:24:37 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4887e884dacsm30811795e9.15.2026.03.31.02.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2026 02:24:36 -0700 (PDT) Date: Tue, 31 Mar 2026 09:24:35 +0000 From: Bertrand Drouvot To: Kuba Knysiak Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Adding per backend commit and rollback counters Message-ID: References: <177490195327.942.4612952714548351097.pgcf@coridan.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uN5gGi2rtCNSVbpC" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <177490195327.942.4612952714548351097.pgcf@coridan.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --uN5gGi2rtCNSVbpC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi, On Mon, Mar 30, 2026 at 08:19:13PM +0000, Kuba Knysiak wrote: > Hello, > after reviewing the patch together with MiƂosz, we found the following: Thanks for the review! > - In pgstatfuncs.c, we call pgstat_fetch_stat_backend_by_pid(beentry->st_procpid, NULL) > for each backend row. That path acquires ProcArrayLock via BackendPidGetProc(), > so this repeats lock acquisition for every row. We could simplify this and avoid > taking the lock altogether by fetching directly with > pgstat_fetch_stat_backend(local_beentry->proc_number). Yeah, I think that's a good point. Done that way in the attached. Also adding a check on the backend type as it was done in pgstat_fetch_stat_backend_by_pid(). > Also, shouldn't this patch bump catversion? Yes and that was mentioned in the 0003 commit message. We usually don't change it in the patch itself (could easily produce rebase noise) but just put an XXX in the commit message so that it's not forgoten when pushed. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --uN5gGi2rtCNSVbpC Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0001-Adding-per-backend-commit-and-rollback-counters.patch"