Re: Constraint exclusion oddity with composite index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Constraint exclusion oddity with composite index
Date: 2007-06-01 21:08:14
Message-ID: 23786.1180732094@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> Tom Lane wrote:
>> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
>>> Assume the following:
>>> index on: (id, adate)
>>> constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007');
>>> The planner will not use the index listed above.
>>
>> For what?

> select adate from parent where adate = '01-25-2007'

That's unsurprising. Searching with only a lower-order index column
value seldom wins, 'cause you've got to scan the entire index. The
constraint is irrelevant to this.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message George Pavlov 2007-06-01 21:09:04 Re: query log corrupted-looking entries
Previous Message Joshua D. Drake 2007-06-01 21:03:07 Re: Constraint exclusion oddity with composite index