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-22 05:30:20
Message-ID: 2379.1300771820@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:
> On Tue, Mar 22, 2011 at 4:35 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Reimplement planner's handling of MIN/MAX aggregate optimization (again).

> I'm just curious, Why is this no longer an interesting special case?

> --- this is an interesting special case as of 9.1
> -explain (costs off)
> - select min(unique2) from tenk1 where unique2 = 42;
> - QUERY PLAN
> ------------------------------------------------
> - Aggregate
> - -> Index Scan using tenk1_unique2 on tenk1
> - Index Cond: (unique2 = 42)

In the pathkey-based implementation, that resulted in an empty pathkey
list, which that implementation couldn't deal with. I figured that was
okay because the default plan isn't bad in such a case, but I put in a
test case (probably because the code failed before I put in a defense
against it, but I don't recall for sure). It's not particularly a
corner case for the new code, though, and the resulting plan changed
(because the new code will in fact turn this into a LIMIT subselect
anyway). So I debated whether to change the expected output or just
take it out, and I chose the latter.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-22 08:06:53 Re: How to look at the Expression Trees
Previous Message Greg Stark 2011-03-22 05:16:35 Re: Planner regression in 9.1: min(x) cannot use partial index with NOT NULL