Re: Partitioned/inherited tables with check constraints causing slower query plans

Список
Период
Сортировка
От Tom Lane
Тема Re: Partitioned/inherited tables with check constraints causing slower query plans
Дата
Msg-id 7297.1336149542@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Partitioned/inherited tables with check constraints causing slower query plans  (Richard Jones)
Ответы Re: Partitioned/inherited tables with check constraints causing slower query plans  (Richard Jones)
Список pgsql-performance
Richard Jones <> writes:
> I'm seeing poor query performance using partitioned tables with check
> constraints, seems like the plan is much worse than when querying the
> individual partitions manually.

> select version(); --> PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu,
> compiled by gcc (Debian 4.4.5-8) 4.4.5, 64-bit

I get a reasonable-looking plan when I try to duplicate this issue in
9.1 branch tip.  I think the reason you're not getting the right
behavior is that you are missing this as-yet-unreleased patch:
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=ef03b34550e3577c4be3baa25b70787f5646c57b
which means it can't figure out that the available index on the child
table produces the desired sort order.  If you're in a position to
compile from source, a current nightly snapshot of the 9.1 branch
ought to work for you; otherwise, wait for 9.1.4.

(Note: although that patch is a one-liner, I would *not* recommend
trying to just cherry-pick the patch by itself; I think it probably
interacts with other planner fixes made since 9.1.1.)

            regards, tom lane

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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: Configuration Recommendations
Следующее
От: Richard Jones
Дата:
Сообщение: Re: Partitioned/inherited tables with check constraints causing slower query plans