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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Jones <rj@xxxxxxxxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux