Re: Strange logic for partial index proving

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Strange logic for partial index proving
Date: 2005-06-21 21:33:45
Message-ID: 1119389626.3645.423.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2005-06-21 at 16:29 -0400, Tom Lane wrote:
> > create index idx1 on tenk (col1) where col1 > 1 and col1 < 10;
>
> > explain select * from tenk where col1 > 5 and col1 < -5;
> > [ uses that index ]
>
> This is a perfectly legitimate situation.

Like I said, its correct. I didn't suggest changing it.

> "col1 > 5" implies "col1 > 1"
> and "col1 < -5" implies "col1 < 10", therefore the query WHERE condition
> implies the index predicate, therefore the index contains all tuples
> that could pass the WHERE condition, therefore the index is usable.

..."all tuples that pass the WHERE condition", like none.

Guess I'm not Mr Logic.

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2005-06-21 21:37:15 Re: Why is checkpoint so costly?
Previous Message Tom Lane 2005-06-21 21:26:40 Re: PROPOSAL FE/BE extension to handle IN/OUT parameters