pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Michael McCarthy <michael@tcsi.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] problem with OR'ed AND queriess
Date: Tue, 21 Dec 1999 22:51:51 -0500 (EST)
Message-ID: <199912220351.WAA26485@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.GSO.3.96.991221112043.9161G-100000@sanmarino.tcsi.com>

> Using PQexec from libpq in postgresql 6.5.3, I submit a query of the
> following form, which has 13 OR'ed AND expressions:
> 
>     DECLARE my_cursor CURSOR FOR SELECT col1 FROM testCNF where
>     ( ( col1=0  and col2=1  ) OR ( col1=1  and col2=2  ) OR
>       ( col1=2  and col2=3  ) OR ( col1=3  and col2=4  ) OR
>       ( col1=4  and col2=5  ) OR ( col1=5  and col2=6  ) OR
>       ( col1=6  and col2=7  ) OR ( col1=7  and col2=8  ) OR
>       ( col1=8  and col2=9  ) OR ( col1=9  and col2=10 ) OR
>       ( col1=10 and col2=11 ) OR ( col1=11 and col2=12 ) OR
>       ( col1=12 and col2=13 ) )

I have this in the cvs log file, and it will appear in 7.0.  You can
check the current cvs snapshot to see how much better it is:

---------------------------------------------------------------------------

revision 1.18
date: 1999/09/07 03:47:06;  author: tgl;  state: Exp;  lines: +236 -249
Performance improvements in cnfify(): get rid of exponential
space consumption in pull_args, and avoid doing the full CNF transform on
operands of operator clauses, where it's really not particularly helpful.
This answers the TODO item about large numbers of OR clauses, at least
partially.  I was able to do a ten-thousand-OR-clause query with about
20Mb memory consumption ... it took an obscenely long time, but it worked...


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



view thread (7+ messages)  latest in thread

Message-ID: <199912220351.WAA26485@candle.pha.pa.us>
Permalink:  ../199912220351.WAA26485@candle.pha.pa.us/
Also on:    postgresql.org/message-id/199912220351.WAA26485@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, michael@tcsi.com
  Subject: Re: [SQL] problem with OR'ed AND queriess
  In-Reply-To: <199912220351.WAA26485@candle.pha.pa.us>
  References: <Pine.GSO.3.96.991221112043.9161G-100000@sanmarino.tcsi.com> <199912220351.WAA26485@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox