Re: Planner regression in 9.1: min(x) cannot use partial index with NOT NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, robertmhaas(at)gmail(dot)com, marti(at)juffo(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Planner regression in 9.1: min(x) cannot use partial index with NOT NULL
Date: 2011-03-21 17:40:41
Message-ID: 3947.1300729241@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> writes:
> So it's a clever hack that we used to allow the partial indexes to be
> used. It relied on the implicit assumption that min(x) and max(x)
> where the only values of x where NULL were both NULL.

> It would be nice if we were clever enough to support *any* strict
> aggregate using partial indexes on WHERE NOT NULL since they'll all
> have that property.

Huh? The point of the min/max optimization is to not scan the whole
index but just fetch the endpoint value. For general aggregates, you
have to scan the table anyway. If an index is useful for that, it'll
get picked up in the normal planning process.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2011-03-21 17:44:51 psql \dt and table size
Previous Message Greg Stark 2011-03-21 17:34:11 Re: Planner regression in 9.1: min(x) cannot use partial index with NOT NULL