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 1wWSP9-002cz3-2A for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 05:20:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWSP8-000gyY-10 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 05:20:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWSP7-000gyQ-2t for pgsql-hackers@lists.postgresql.org; Mon, 08 Jun 2026 05:20:05 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wWSP5-00000001dYA-46md for pgsql-hackers@lists.postgresql.org; Mon, 08 Jun 2026 05:20:04 +0000 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-842d37438d8so337855b3a.0 for ; Sun, 07 Jun 2026 22:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780896003; x=1781500803; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=8Y85UntI+ijs12jxkRUuOtUvYSAugpSo6YjcD6hpoxE=; b=UZtSNkYJcFCwNKhpEdO4zpFKfstIg5IknsScHBPBZ+Ow04j30o0ji5rgdu5Fo52qsm QFBdYyHBN2FC6zxnpFlqtckNHM/0Zn5xuOjS0awIyWCkOYX8zk+j7oX1IN9xjRuMZN+p mH8laX+qb3SeRNI0zFOemoNDyTgYca6i5AwC5VOfxQPdICbhULw/hisV6LOS2yZfllvS kmyaXunFNk778J9yb36zBUZmxFiojX6Cn6hQZdDN4uxv5KLHdmQEKpif+NIJqRmYNebo jNzuuwtTuau28fCSoZIkXxEHT0XNZzV9SZPxtcx12saUnsAlZGpdyE/+e34b7i3RPjl7 IE0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780896003; x=1781500803; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Y85UntI+ijs12jxkRUuOtUvYSAugpSo6YjcD6hpoxE=; b=Vrhn+OfScYwDo0R7BBd0wocNG5PaPxSSshLjyBXRSuBv2zCcCSVYuCWJ2nAEGlWebd IxPlfaStWLPVy3wd8SGluoEpn4hUxVIJ68QgorA0E1guvMq1NrTFj4ITQC5MxUthu3p7 Zk3ZMPxFOj3XbeT08+Y8FDgEOBifNND8WgEmS762gcPAEeE9nhZI9KddeEnIMxSMfi9n FquFNoRHCv7rOCETceej+oqrzV1fqKo+GEpfmPw1543KgAmI02VavRjd7NGVe3AWexW4 BDudAC77mx8dlKZ7ilcUVH3Nl20OxPzBLtqJMz+AdabHD1OVfiWwv0h/BUJ9lsAhY7JB +mDg== X-Gm-Message-State: AOJu0YxHPc6tx/HBQbtSuLVY7qbGb9xwji/UFle4kxtZXecgJn2Y9rZ6 ciMXogASJi0Qfb9UWHgvosp1jq4v+xDVOPVJRpduvzEG25mZj4Q7qP6i X-Gm-Gg: Acq92OEeguA1fkW5hpgfY3tz9IszLJVBdERqdlPAxLpGwBk5+wguf+4SnThbBofLAUq 3dIKUOGYF6pu5v841NBk63oXHacsX5QbvwvGOT3gCeqIAlG+aWYGrdt7exSLtMVCmVC5tNSwoe6 /5DyzDmvmCJTDDROs6HMfzgw2fFKFREhph6kKSdTiESgH0VSvsTqLdua093/NszpHtf7+DyOGeL iCUjv5vuJQ/CYH/x2uZWOlbQQdB9h2g+X9xFz6Z10wEw7+IorGmNx+UATVD2isRIkVG+UKrkZA8 xQCb9DHkThJF1hKxSn5en6VhMKr3BGQIUGYzFQDHzWjHeooA8gZD9s/Ix+jZB8492bsUpOBsX7U k+DiXdm25cAjJelHZioSOBY/HOphsWeNnCSg0ehomRHwVMcr9LWmMkzTyFoj3kqQ8T34YNyfWh+ V4mWjaZazZLyFOW8IDNjWTLI9tUCAsgGsWOgvVn7MFF+GxtTYK+TcYCxgU747L95lJDO1wWdAK/ Gffq310Og== X-Received: by 2002:a05:6a00:8d82:b0:842:380a:1ee8 with SMTP id d2e1a72fcca58-842b0e6b7ecmr15656152b3a.17.1780896002883; Sun, 07 Jun 2026 22:20:02 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828821ddsm16655139b3a.35.2026.06.07.22.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 22:20:02 -0700 (PDT) Date: Mon, 08 Jun 2026 14:20:00 +0900 (JST) Message-Id: <20260608.142000.1993011436447649540.horikyota.ntt@gmail.com> To: li.evan.chao@gmail.com Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Adjust pg_stat_get_lock() prorows to match lock types From: Kyotaro Horiguchi In-Reply-To: <75836FCA-2A8A-4DED-A13F-888595460A2D@gmail.com> References: <75836FCA-2A8A-4DED-A13F-888595460A2D@gmail.com> User-Agent: Mew version 6.8 on Emacs 29.4 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello. At Mon, 4 May 2026 10:23:47 +0800, Chao Li wrote in > I read the code of pg_stat_lock() and played a bit with it. I happened = > to notice one thing: the function always returns 12 rows, but the = > planner estimates 10 rows: I'm not convinced this needs to be adjusted. The prorows value is only a rough estimate for the planner, not an exact row count. For example, pg_show_all_settings() has prorows = 1000, while it returns substantially fewer rows in my build. That suggests these values are intended to provide a reasonable estimate rather than an exact count. Given that, I don't think a difference between 10 and 12 rows is worth fixing. Keeping prorows synchronized with the exact number of lock types would only add maintenance overhead whenever a new lock type is introduced. If the current estimate is shown to cause a planning problem, I'd rather address that problem directly than try to keep prorows exactly synchronized with the number of lock types. This discussion also made me wonder whether the documentation could be a bit more explicit that prorows is intended as a planner estimate rather than an exact row count. > Estimated number of result rows (zero if not proretset) Regards. -- Kyotaro Horiguchi NTT Open Source Software Center