Re: Oddball data distribution giving me planner headaches

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Oddball data distribution giving me planner headaches
Дата
Msg-id 25344.1322863743@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Oddball data distribution giving me planner headaches  (Jeff Amiel <becauseimjeff@yahoo.com>)
Ответы Re: Oddball data distribution giving me planner headaches
Re: Oddball data distribution giving me planner headaches
Список pgsql-general
Jeff Amiel <becauseimjeff@yahoo.com> writes:
> Oddball data distribution giving me headaches.
> [ 'distributor' customers have many more child customers than average ]
> Does this oddball data distribution doom me to poor planning forever?

The only real fix for that will require cross-column statistics, which
we don't have yet --- without such, there's no way for the planner to
know that distributors have an atypical number of child customers.

At the moment I think the only way to work around this is to denormalize
your schema a bit.  For instance, if you were to include the parent
customer_type directly into the customer_rel table, that would not only
save one join in this query but it would expose the stats the planner
needs to realize that it's going to get a lot of matches.  If you don't
like that particular solution there are probably other ways to get the
same result, but they're all going to require schema changes.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Amiel
Дата:
Сообщение: Re: Oddball data distribution giving me planner headaches
Следующее
От: "David Johnston"
Дата:
Сообщение: Re: Oddball data distribution giving me planner headaches