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 5174D9DC80E for ; Thu, 26 Jan 2006 06:54:03 -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 64522-01 for ; Thu, 26 Jan 2006 06:54:05 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) by postgresql.org (Postfix) with ESMTP id 00CEC9DC842 for ; Thu, 26 Jan 2006 06:54:00 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so339476nzn for ; Thu, 26 Jan 2006 02:54:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sUs6u9otjcgHaB4IHyXoNUfX/NdiV7c2TFZn9a0zxm/0oy/Ru3QvaqpAwhQZ6phdfmLR3IqsyqatCc9M3wpeTSs3kBDfSAYU/o0M8XfuyQawCEJXubLjYsZDuvJsuXMVt8I6VtoUvtyFpEho9jF3s0Tnq6iqSv67lLMjj3V1Sk8= Received: by 10.65.157.4 with SMTP id j4mr1221081qbo; Thu, 26 Jan 2006 02:54:03 -0800 (PST) Received: by 10.65.135.12 with HTTP; Thu, 26 Jan 2006 02:54:03 -0800 (PST) Message-ID: <29d3b0b90601260254n10d2c9aby77651744337020f8@mail.gmail.com> Date: Thu, 26 Jan 2006 11:54:03 +0100 From: andrew To: pgsql-sql@postgresql.org Subject: Re: filtering after join In-Reply-To: <200601261127.05442.peter_e@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <29d3b0b90601250927o2a5ee6e6mc33a7647da4438ce@mail.gmail.com> <200601252011.13465.peter_e@gmx.net> <29d3b0b90601251213g7f90dac7x9c524544ba72f61b@mail.gmail.com> <200601261127.05442.peter_e@gmx.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.225 required=5 tests=[AWL=0.225] X-Spam-Score: 0.225 X-Spam-Level: X-Archive-Number: 200601/177 X-Sequence-Number: 23966 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 wrote: > andrew wrote: > > Sorry for the confusion. This is what i meant. Thanks, Michael. > > > > select * > > from (select * from A, B where A.a =3D 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=3DB.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