Re: partitioning for speed, but query planner ignores

From: David Rysdam <drysdam(at)ll(dot)mit(dot)edu>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: partitioning for speed, but query planner ignores
Date: 2013-10-02 13:22:32
Message-ID: 87fvsjst7r.fsf@loud.llan.ll.mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2 Oct 2013 09:12:02 -0400, Bill Moran <wmoran(at)potentialtech(dot)com> wrote:
> Last I looked, the partitioning mechanism isn't _quite_ as smart as could
> be desired. For example:
> SELECT * FROM table WHERE objnum = 5; -- will not take advantage of partition
> You have to give the planner a little more hint as to the fact that it can
> take advantage of the partition:
> SELECT * FROM table WHERE (objnum % 2) = 1 AND objnum = 5;
> As silly as it seems, this is enough information for the planner to know
> that it only needs to scan one partition.

This seemed ridiculously silly until I thought about it. I guess it has
no way of "unwrapping" my constraint and figuring out what to do. Would
this also apply if I did ranges or is that a common enough constraint
that it *can* figure it out without me having to modify all my queries?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-10-02 13:46:24 Re: [HACKERS] Who is pgFoundery administrator?
Previous Message Bill Moran 2013-10-02 13:12:02 Re: partitioning for speed, but query planner ignores