From: | "ben sewell" <mosherben(at)gmail(dot)com> |
---|---|
To: | "Michael Fuhr" <mike(at)fuhr(dot)org>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Postgresq 8,1 hangs when running function |
Date: | 2006-08-21 13:31:37 |
Message-ID: | bf6c74d80608210631w65cd1dc0t4f6c2536f6fc754a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi guys, thanks for the tips. Yup I ran the query with the joins in this
time. Explain analyze returned 68 rows this time, in 570 MS. Is the MS time
normal?
ok now I seem to be getting somewhere, inputting stuff into my function and
now it's saying returned record type does not match expected record type,
even thorugh I give the types of the fields in the query. Any ideas? I've
checked the fields I am expecting to be returned against what they are
stored as in the DB and there are nothing different.
Cheers,
Ben
On 8/21/06, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
>
> 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-08-21 13:58:38 | Re: Postgresq 8,1 hangs when running function |
Previous Message | Michael Fuhr | 2006-08-21 12:59:03 | Re: Postgresq 8,1 hangs when running function |