Re: BUG #16521: n_distinct_inherited does not affect child partitions when set on main partition

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Klaudie Willis <Klaudie(dot)Willis(at)protonmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16521: n_distinct_inherited does not affect child partitions when set on main partition
Date: 2020-07-02 22:28:20
Message-ID: CAApHDvrgABj0voy54omL-41cbomrwRkONQSr738kC6NVbqvDVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 2 Jul 2020 at 05:16, Klaudie Willis
<Klaudie(dot)Willis(at)protonmail(dot)com> wrote:
> "n_distinct affects the statistics for the table itself, while n_distinct_inherited affects the statistics
> gathered for the table plus its inheritance children."
>
> I see that this text has multiple interpretations. I read it more like: while n_distinct_inherited affects the statistics gathered [by analyze] for the table plus [affects the statistics of] its inheritance children.

I see. I didn't read it that way before, but it's fairly obvious now
that that's how you interpreted it. I think there's room here to
change the documentation so that future readers are not misled.

How about?

diff --git a/doc/src/sgml/ref/alter_table.sgml
b/doc/src/sgml/ref/alter_table.sgml
index cbfb4828e5..2495564b07 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -328,8 +328,8 @@ WITH ( MODULUS <replaceable
class="parameter">numeric_literal</replaceable>, REM
number-of-distinct-values estimates made by subsequent
<xref linkend="sql-analyze"/>
operations. <literal>n_distinct</literal> affects the
statistics for the table
- itself, while <literal>n_distinct_inherited</literal> affects
the statistics
- gathered for the table plus its inheritance children. When set to a
+ itself, while <literal>n_distinct_inherited</literal> affects the table's
+ inheritance statistics. When set to a
positive value, <command>ANALYZE</command> will assume that the
column contains
exactly the specified number of distinct nonnull values. When set to a
negative value, which must be greater

David

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-07-03 09:19:05 BUG #16524: PgAdmin for macbook users creates an overlay on the UI which disables all functionality of PgAdmin
Previous Message Tom Lane 2020-07-02 16:51:24 Re: cannot restore schema with is not distinct from on hstore since PG 9.6.8