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 1oOK6P-0004o1-Hx for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 14:33:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOK6O-0007ST-DE for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 14:33:00 +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 1oOK6O-0007SK-5K for pgsql-docs@lists.postgresql.org; Wed, 17 Aug 2022 14:33:00 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOK6L-0004zl-QX for pgsql-docs@lists.postgresql.org; Wed, 17 Aug 2022 14:32:59 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oOK6J-000vWY-GQ; Wed, 17 Aug 2022 10:32:55 -0400 Date: Wed, 17 Aug 2022 10:32:55 -0400 From: Bruce Momjian To: stefan.keller@ost.ch, pgsql-docs@lists.postgresql.org Cc: Tomas Vondra Subject: Re: Empty values of pg_stats_ext when table is empty Message-ID: References: <163577298184.680.6561061840343770915@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163577298184.680.6561061840343770915@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 1, 2021 at 01:23:01PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/14/view-pg-stats-ext.html > Description: > > When table mytable is being inherited it may not contain any data but still > return row sets from the inheriting tables. Now doing CREATE STATISTICS on > mytable will work but won't have any values. > > This is very difficult to realize from a user's perspective and can be > either considered a feature or a bug, i.e. being enhanced. > > Given this is considered as a feature, I suggest to add a comment at the end > of this documentation > https://www.postgresql.org/docs/current/view-pg-stats-ext.html like this: > > << > Note then there are no values when the table is empty which happens when > there are tables which inherit from it. > << > > I could also think of a run-time warning? I talked to Tomas Vondra and he says there will be proper parent statistics in PG 15, due to be released in the next 1-2 months. Here is the PG 15 release note item: https://www.postgresql.org/docs/15/release-15.html Allow extended statistics to record statistics for a parent with all its children (Tomas Vondra, Justin Pryzby) Regular statistics already tracked parent and parent/all-children statistics separately. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson