Re: [PERFORM] MAX() and multi-column index on a partitioned table?

2015-05-22 Thread Tom Lane
Dave Johansen davejohan...@gmail.com writes:
 I'm trying to call MAX() on the first value of a multi-column index of a
 partitioned table and the planner is choosing to do a sequential scan
 instead of an index scan. Is there something I can do to fix this?

What PG version are you using?  9.1 or newer should know how to do this
with a merge append of several indexscans.

regards, tom lane


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


Re: [PERFORM] MAX() and multi-column index on a partitioned table?

2015-05-22 Thread Dave Johansen
On Fri, May 22, 2015 at 3:42 PM, Tom Lane t...@sss.pgh.pa.us wrote:

 Dave Johansen davejohan...@gmail.com writes:
  I'm trying to call MAX() on the first value of a multi-column index of a
  partitioned table and the planner is choosing to do a sequential scan
  instead of an index scan. Is there something I can do to fix this?

 What PG version are you using?  9.1 or newer should know how to do this
 with a merge append of several indexscans.


Sorry, I should have mentioned that in the original email. I'm using 8.4.20
on RHEL 6. From your reply, it sounds like this is the expected behavior
for 8.4 and 9.0. Is that the case?
Thanks,
Dave


Re: [PERFORM] MAX() and multi-column index on a partitioned table?

2015-05-22 Thread Tom Lane
Dave Johansen davejohan...@gmail.com writes:
 On Fri, May 22, 2015 at 3:42 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 What PG version are you using?  9.1 or newer should know how to do this
 with a merge append of several indexscans.

 Sorry, I should have mentioned that in the original email. I'm using 8.4.20
 on RHEL 6. From your reply, it sounds like this is the expected behavior
 for 8.4 and 9.0. Is that the case?

Yeah, pre-9.1 is not very bright about that.  You could factor the query
manually, perhaps, though it's surely a pain in the neck.

regards, tom lane


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