Re: Strange explain on partitioned tables

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: gvfontenay(at)lbl(dot)gov
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Strange explain on partitioned tables
Date: 2010-07-24 05:12:28
Message-ID: 4C4A763C.8090701@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Gerald Fontenay wrote:
>
>> The PostgreSQL partitioning system is aimed to support perhaps a
>> hundred inherited tables. You can expect to get poor performance on
>> queries if you create 1000 of them.
>
> Why is that you would expect poor performance for say 1000 or more?

When the query planner executes, it has to scan through every child
table to run the constraint exclusion algorithm for determining whether
that table needs to be included in the query results or not. The time
that takes is proportional to the number of partitions. If your queries
take a long time to execute relative to how long they take to plan, you
may not have noticed this. But for shorter queries, and ones where
there are lots of joins that require many plans be evaluated, the
planning overhead increase can be significant. The threshold for where
it becomes painful is obviously workload dependent, but the thing to be
careful of is that supporting very large numbers of partitions is not
something that the database query planner has been optimized for yet.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andres Freund 2010-07-24 05:13:50 Re: Pooling in Core WAS: Need help in performance tuning.
Previous Message Joshua D. Drake 2010-07-23 22:16:10 Re: Strange explain on partitioned tables