Re: partial index on varchar-coloumn in 7.4.1

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martin Hampl <Martin(dot)Hampl(at)gmx(dot)de>, pgsql-novice(at)postgresql(dot)org
Subject: Re: partial index on varchar-coloumn in 7.4.1
Date: 2004-01-08 18:48:30
Message-ID: 20040108184830.GA29084@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Jan 07, 2004 at 17:35:52 -0500,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> There's still no intelligence about NOT in the theorem prover, but it
> turns out that it's not seeing NOT. By the time the expressions get to
> the point of being compared, NOT (a=b) has been folded to a<>b, and it
> turned out to be fairly straightforward to extend the existing logic to
> reason about such cases. The above example requires a process like
> "a = x implies a <> y if x <> y" (where x and y are constants, so the
> "if" part can be checked). This fits right in with what the code could
> do already, which was cases like "a > x implies a > y if x > y".
> So it'll work more naturally in 7.5.

This implication relies on = being transitive. I was curious about how you
test for that since there doesn't seem to be a direct way to know that.
My guess would be that operators used in an opclass are assumed to be
transitive, since I don't think indexing would work if they weren't.

This same test would also work for other transitive operators with a negator.
For example:
a < x implies y >= a if y >= x

You can do a bit better if you know that exactly one of the relations
=, <, > is true for any ordered pair of operands. But there may be cases
where you don't have that much structure.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-01-08 21:14:55 Re: partial index on varchar-coloumn in 7.4.1
Previous Message Tom Lane 2004-01-08 17:38:33 Re: pl/pgSQL sequence question