Re: Stats for inheritance trees

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stats for inheritance trees
Date: 2009-12-29 15:29:53
Message-ID: 23532.1262100593@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> On Mon, 2009-12-28 at 17:41 -0500, Tom Lane wrote:
>> 2. When ANALYZE is invoked on a table that has inheritance children,
>> it will perform its normal duties for just that table (creating or
>> updating entries with stainherit = false) and then perform a second
>> scan that covers that table and all its children. This will be used
>> to create or update entries with stainherit = true. It might be
>> possible to avoid scanning the parent table itself twice, but I won't
>> contort the code too much to avoid that, since in most practical
>> applications the parent is empty or small anyway.

> Will there be logic to decide how stainherit should be set? Many columns
> in an inherited set have similar values in different children, e.g.
> OrderValue, OrderStatus but many columns also have very different values
> in different children. e.g. OrderId, OrderPlacementDate,
> OrderFulfillmentDate

I don't see that that's relevant here. We're trying to estimate the
overall result of a join against an inheritance tree. The fact that
some or even all of the matching rows might come from specific child
tables is not relevant at this level of detail. When it is relevant,
we'll be looking at the child-table stats (and constraints), not at
the parent's.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-12-29 15:38:44 Re: IntArray in c.h
Previous Message Tom Lane 2009-12-29 15:24:38 Re: [PATCH] Provide rowcount for utility SELECTs