X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 40EC09DCB5C for ; Thu, 26 Jan 2006 06:27:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58226-03 for ; Thu, 26 Jan 2006 06:27:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.net [213.165.64.21]) by postgresql.org (Postfix) with SMTP id D2EBD9DCB3C for ; Thu, 26 Jan 2006 06:27:04 -0400 (AST) Received: (qmail invoked by alias); 26 Jan 2006 10:27:06 -0000 Received: from dslb-084-063-027-189.pools.arcor-ip.net (EHLO colt.pezone.net) [84.63.27.189] by mail.gmx.net (mp032) with SMTP; 26 Jan 2006 11:27:06 +0100 X-Authenticated: #495269 From: Peter Eisentraut To: pgsql-sql@postgresql.org Subject: Re: filtering after join Date: Thu, 26 Jan 2006 11:27:05 +0100 User-Agent: KMail/1.8.3 Cc: andrew References: <29d3b0b90601250927o2a5ee6e6mc33a7647da4438ce@mail.gmail.com> <200601252011.13465.peter_e@gmx.net> <29d3b0b90601251213g7f90dac7x9c524544ba72f61b@mail.gmail.com> In-Reply-To: <29d3b0b90601251213g7f90dac7x9c524544ba72f61b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601261127.05442.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.132 required=5 tests=[AWL=0.132] X-Spam-Score: 0.132 X-Spam-Level: X-Archive-Number: 200601/176 X-Sequence-Number: 23965 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 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/