Re: Improve docs for n_distinct_inherited

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improve docs for n_distinct_inherited
Date: 2025-05-08 14:49:32
Message-ID: CAKFQuwYo6o0AY-EvnndHnVALY8dqo+mZo1rprUoZH_xyTe381g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 7, 2025 at 11:41 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> On Thu, 8 May 2025 at 15:23, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> > Not liking the proposal, not sure it is even correct. Somehow "children
> of inheritance parent tables" are omitted.
>
> I don't see the quoted text anywhere in this area, so I'm not sure I
> follow what you mean with the omission.
>

Omitted from your v1 patch.

The two options for sample
> sets are 1) stainherits==true and 2) stainherits==false. With
> inheritance parent tables, ANALYZE gathers both sets and records both
> sets in pg_statistic.

I was missing this key piece of knowledge which invalidated my entire
attempt.

Here's an attempt at shortening this now that I understand the mechanics
better.

Separate options exist because an inheritance parent table has two
different sets of statistics: one considering only itself and one
which
also includes its children (<literal>n_distinct_inherited</literal>).
Partitioned tables, which only have rows in the children, likewise
uses
the inherited option while everyone else uses
<literal>n_distinct</literal>.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-05-08 15:05:20 Re: disabled SSL log_like tests
Previous Message Tom Lane 2025-05-08 14:27:58 Re: Valgrind - showing memory leaks