Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id TAA72448 for ; Tue, 21 Dec 1999 19:02:42 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id TAA13402; Tue, 21 Dec 1999 19:02:00 -0500 (EST) To: Michael McCarthy cc: pgsql-sql@postgresql.org Subject: Re: [SQL] problem with OR'ed AND queriess In-reply-to: References: Comments: In-reply-to Michael McCarthy message dated "Tue, 21 Dec 1999 13:05:18 -0800" Date: Tue, 21 Dec 1999 19:02:00 -0500 Message-ID: <13399.945820920@sss.pgh.pa.us> From: Tom Lane Michael McCarthy 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