Re: Query planner question (7.4.5)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Arthur Ward <award(at)dominionsciences(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Query planner question (7.4.5)
Date: 2005-02-08 05:52:37
Message-ID: 2826.1107841957@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Arthur Ward <award(at)dominionsciences(dot)com> writes:
> The problem for us is that the default estimate at the HashAggregate is
> absurdly low, undercutting the other available join candidates' row
> estimates resulting in _bad_ plans. What I was wondering is whether the
> planner has enough information available when looking at the
> HashAggregate step (the IN clause that started this whole mess) to
> consider the statistics of the inputs to the Append.

Not at the moment ... UNION (and other set-operation nodes) are pretty
much terra incognita to the planner's estimation routines. If you feel
motivated to work on it, step right up ...

> Additionally, those subquery scans are simple queries without anything
> to cause the table statistics to be thrown away if they can be reused in
> later steps (or is the rowcount the only stat used after a node is
> created?) -- one subquery is a single-table filter, the other is a two
> table join, also nothing special.

The rowcount does propagate up just fine, but guesstimates about numbers
of distinct values don't know anything about these structures. Right
offhand I'm not sure what a suitable framework for handling this would
look like.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ohp 2005-02-08 07:15:42 problemsafter crash
Previous Message Greg Stark 2005-02-08 04:41:01 Re: PHP/PDO Database Abstraction Layer