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 1qeJdY-006ShE-4f for pgsql-docs@arkaria.postgresql.org; Thu, 07 Sep 2023 18:21:52 +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 1qeJdV-003sFy-Nq for pgsql-docs@arkaria.postgresql.org; Thu, 07 Sep 2023 18:21:49 +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 1qeJdV-003sFb-FC for pgsql-docs@lists.postgresql.org; Thu, 07 Sep 2023 18:21:49 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeJdR-003irH-2s for pgsql-docs@lists.postgresql.org; Thu, 07 Sep 2023 18:21:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description; bh=cJZSTT333X1mNzzeg15ANnsu7pexw8IbYw2daIQOQXs=; b=hhJx3 gksf5jDIhO+dTvoByjmFn6VSy0Q8Xu63uu/zPBF+ckbKo8pZtM+2wZ4h84BkKly971TOJo87pudC2 D+C7jqCtJLBkkRZEd3RIzjHuLClqkQf/DP5HuX7zieu+uSf3Fh5sg2LKvOZ5x/KiVCwE178Y3T/Sn JW5sefCle+qiQb3HcdkxyFIOqFTWtOf6YuQWiXdei/bbz9QoU5qx+/RDqJNY0N9fvZkx3UDlr2YRl Cuw2BPvmYpNKwqHIsmkmLThFXQtxEUqGRPZtGvpaZokngrWiuLxVPHURJu2blQAnSx7K29TLJqV+P nt+OFLotAZ+my7/CfK8/Fu0sDcA7g==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qeJdP-00FviU-1O; Thu, 07 Sep 2023 14:21:43 -0400 Date: Thu, 7 Sep 2023 14:21:43 -0400 From: Bruce Momjian To: m.sakrejda@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: pg_class.relpages documentation does not mention relpages corner case Message-ID: References: <168600622919.640.13784585346362749956@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <168600622919.640.13784585346362749956@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jun 5, 2023 at 11:03:49PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/14/catalog-pg-class.html > Description: > > In the pg_class documentation [1], the relpages column is described as > > >Size of the on-disk representation of this table in pages (of size BLCKSZ). > This is only an estimate used by the planner. It is updated by VACUUM, > ANALYZE, and a few DDL commands such as CREATE INDEX. > > However, it looks like this is -1 for partitioned tables. At least for ones > that have children and have been analyze since adding a child partition, it > seems. I'm not sure how to word that concisely, but should the documentation > note this case? Or can this just be zero for partitioned tales? I'm not sure > if it's too late for that, but they don't actually have any relpages, so it > seems odd that they need a sentinel value. Uh, there are discussions about needing to run ANALYZE on partitioned tables, so in those cases the statistics would be cumulative of all partitions: https://www.postgresql.org/message-id/20230112232747.GA2111950@nathanxps13 If we set the relpages to zero, that would not be reflecting the partitions. I feel -1 is probably the best unless we want to put the total of all partitions in there, but that would be confusing too. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.