Re: filtering after join - Mailing list pgsql-sql

From andrew
Subject Re: filtering after join
Date
Msg-id 29d3b0b90601260254n10d2c9aby77651744337020f8@mail.gmail.com
Whole thread Raw
In response to Re: filtering after join  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: filtering after join  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-sql
But the function foo() would produce different values for the two
queries, so the result will be different.
A simple example is foo() computes the sum of all the integer fields
of the input record.

On 1/26/06, Peter Eisentraut <peter_e@gmx.net> wrote:
> andrew wrote:
> > Sorry for the confusion. This is what i meant. Thanks, Michael.
> >
> > select *
> > from (select * from A, B where A.a = B.b) as s
> > where foo(s) < 2;
> >
> > On 1/25/06, Peter Eisentraut <peter_e@gmx.net> wrote:
> > > andrew wrote:
> > > > I want to use a UDF to filter tuples t that are generated after a
> > > > join. More specifially, I have a UDF foo(record), which computes
> > > > a value for a given tuple.  I can do the filtering before the
> > > > join. e.g.:
> > > >
> > > > select * from A, B where foo(A)<2 and A.a=B.b;
>
> Note that these two queries will produce the same internal execution
> plan, so if you wanted to make some difference you will not.
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>


--
andrew


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: filtering after join
Next
From: Peter Eisentraut
Date:
Subject: Re: filtering after join