Re: Postgresq 8,1 hangs when running function

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
Cc: ben sewell <mosherben(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgresq 8,1 hangs when running function
Date: 2006-08-21 12:59:03
Message-ID: 20060821125903.GA24063@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Aug 21, 2006 at 08:37:21AM -0400, Sean Davis wrote:
> If your SQL from your function has the same behavior when you execute it, it
> is likely one of two problems:
>
> 1) You are doing an unconstrained CROSS JOIN and getting a large result set

Check the parentheses around the OR expressions in the queries'
WHERE clauses. The queries have their join conditions separated
by AND and then an OR that looks like it needs an extra set of
parentheses. That is, instead of this:

AND cond1 AND cond2 AND (cond3 AND cond4) OR (cond5 AND cond6)

try this:

AND cond1 AND cond2 AND ((cond3 AND cond4) OR (cond5 AND cond6))

or

AND cond1 AND cond2 AND (cond3 AND cond4 OR cond5 AND cond6)

Otherwise, as Sean said, you're getting cross joins.

--
Michael Fuhr

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message ben sewell 2006-08-21 13:31:37 Re: Postgresq 8,1 hangs when running function
Previous Message Sean Davis 2006-08-21 12:37:21 Re: Postgresq 8,1 hangs when running function