Re: [HACKERS] RE: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: taral(at)mail(dot)utexas(dot)edu (Taral)
Cc: jwieck(at)debis(dot)com, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] RE: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)
Date: 1998-10-04 03:32:14
Message-ID: 199810040332.XAA06650@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> > however if A and C are identical, this could become:
> >
> > (A OR A) AND (A OR D) AND (B OR A) AND (B OR D)
> >
> > and A OR A is A:
> >
> > A AND (A OR D) AND (B OR A) AND (B OR D)
> >
> > and since we are now saying A has to be true, we can remove OR's with A:
> >
> > A AND (B OR D)
>
> Very nice... and you could do that after each iteration of the rewrite,
> preventing the size from getting too big. :)
>
> I have a symbolic expression tree evaluator that would be perfect for
> this... I'll see if I can't adapt it.
>
> Can someone mail me the structures for expression trees? I don't want to
> have to excise them from the source. Please?

That is very hard to do. We have lots of structures involved. I
recommend you look at backend/optimizer/prep/prepqual.c. That has the
CNF'ify code, and I am studying it now. There are supporing functions
on backend/nodes that will allow comparisons of many structures.

We may not be that far off. normalize() does much of the work, and
qual_cleanup() reomves duplicates using remove_duplicates(), but
qual_cleanup() is only called after normalize completes, not during the
normalization, which seems to be the problem. If we can remove the
duplicates BEFORE the OR explosion, we are much better off.

You can then use ctags to jump around to see the supporting structures.
See the developers FAQ in the web site or doc directory.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Ansley 1998-10-04 09:40:29 Add/Remove Columns
Previous Message Taral 1998-10-04 02:26:20 RE: [HACKERS] RE: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-10-04 04:18:25 Re: IP test program
Previous Message Terry Mackintosh 1998-10-04 03:11:04 Re: [HACKERS] Dumping of views -- done!