Re: partitioning for speed, but query planner ignores - Mailing list pgsql-general

From David Rysdam
Subject Re: partitioning for speed, but query planner ignores
Date
Msg-id 87fvsjst7r.fsf@loud.llan.ll.mit.edu
Whole thread Raw
In response to Re: partitioning for speed, but query planner ignores  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-general
On Wed, 2 Oct 2013 09:12:02 -0400, Bill Moran <wmoran@potentialtech.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?

Attachment

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: partitioning for speed, but query planner ignores
Next
From: Merlin Moncure
Date:
Subject: Re: [HACKERS] Who is pgFoundery administrator?