Re: select max(column) from parent table very slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Sriram Dandapani <sdandapani(at)counterpane(dot)com>, "Pgsql-Performance (E-mail)" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: select max(column) from parent table very slow
Date: 2006-08-25 04:33:27
Message-ID: 18394.1156480407@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> Sriram Dandapani wrote:
>> Parent table has a column say column1 which is indexed (parent table and
>> all child tables are indexed on that column)

> In older versions of postgresql that would scan the whole table. In 8.1
> and above it doesn't. However, I am guess that since this is a
> partitioned table the planner isn't smart enough to just perform the
> query on each child and a max on the set that is returned.

It is not. Feel free to submit a patch for planagg.c ...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joshua D. Drake 2006-08-25 05:16:43 Re: select max(column) from parent table very slow
Previous Message Joshua D. Drake 2006-08-25 01:08:49 Re: select max(column) from parent table very slow