Re: Canonicalization of WHERE clauses considered harmful

From: Kurt Roeckx <Q(at)ping(dot)be>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Canonicalization of WHERE clauses considered harmful
Date: 2003-12-10 22:58:14
Message-ID: 20031210225813.GA27230@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 10, 2003 at 05:35:11PM -0500, Tom Lane wrote:
> Kurt Roeckx <Q(at)ping(dot)be> writes:
> > On Wed, Dec 10, 2003 at 04:54:54PM -0500, Tom Lane wrote:
> >> (a AND b) OR (a AND c)
> >> expands by repeated application of the distributive law to
> >> (a OR a) AND (a OR c) AND (b OR a) AND (b OR c)
>
> > This is wrong.
>
> I don't think so. The distributive law is
>
> a OR (b AND c) == (a OR b) AND (a OR c)

Oh, I was reading it wrong.

So basicly it makes a + bc = (a+b)*(a+c) = a + ab + ac + bc
And ab + ac = a * (a+b) * (a+c) * (b+c) = ab + abc + ac

(This is so much easier to read then using AND and OR.)

Kurt

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2003-12-10 23:05:34 CSV hack
Previous Message Jason Tishler 2003-12-10 22:55:50 Re: postgres panic error