Re: [SQL] problem with OR'ed AND queriess

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael McCarthy <michael(at)tcsi(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] problem with OR'ed AND queriess
Date: 1999-12-22 00:02:00
Message-ID: 13399.945820920@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael McCarthy <michael(at)tcsi(dot)com> writes:
> I have traced the backend server in a debugger; a stack trace is attached
> below. What I see in examining the code is a recursive normalization of
> the query; postgres is running out of memory trying to convert the OR'ed
> ANDs query to conjunctive normal form (CNF).

Yes, the CNF-conversion code is pretty awful. I have reduced its
badness somewhat in current sources, but really we need to rethink the
whole problem --- for queries that are naturally expressed as
OR-of-ANDs, forcing the condition into AND-of-ORs is a loser.

You could try folding prepqual.c from current sources (get the nightly
snapshot or use CVS) into 6.5. I'm not sure it would merge cleanly,
but it'd beat reinventing the fixes I made.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stuart Gopen 1999-12-22 00:14:41 query result formatting
Previous Message Michael McCarthy 1999-12-21 23:33:29 Re: [SQL] problem with OR'ed AND queriess