X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F101E53B0C for ; Fri, 22 Apr 2005 07:08:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74182-02 for ; Fri, 22 Apr 2005 10:08:53 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) by svr1.postgresql.org (Postfix) with ESMTP id 87D405369B for ; Fri, 22 Apr 2005 07:08:50 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 34so1314871nzf for ; Fri, 22 Apr 2005 03:08:50 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=giu9tBSLahQctvUml3qT7FHej95I04fnmmMpGW/I5e3KSgVVZWYU3EcBC8Soe+jQnMI8COKHor4pAbKRosWzmf3gTlrFGoqMs33LxyteBzwviLYkFMUdYBb/+MLvQHZUL6OAdHpaHEOUqOKl8f3gvIKZBoy7Vq6xqO08rz2+yWI= Received: by 10.36.9.2 with SMTP id 2mr278627nzi; Fri, 22 Apr 2005 03:08:50 -0700 (PDT) Received: by 10.36.22.15 with HTTP; Fri, 22 Apr 2005 03:08:50 -0700 (PDT) Message-ID: <758d5e7f0504220308453c0dbc@mail.gmail.com> Date: Fri, 22 Apr 2005 12:08:50 +0200 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: weigelt@metux.de, pgsql-performance@postgresql.org Subject: Re: immutable functions vs. join for lookups ? In-Reply-To: <20050421192357.GC16548@nibiru.borg.metux.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2596@Herge.rcsinc.local> <22219.1113839449@sss.pgh.pa.us> <87u0m4j5p0.fsf@stark.xeocode.com> <25151.1113853826@sss.pgh.pa.us> <20050421192357.GC16548@nibiru.borg.metux.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.764 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200504/611 X-Sequence-Number: 12008 On 4/21/05, Enrico Weigelt wrote: > * Tom Lane wrote: >=20 > > > Yeah, I was actually thinking about a two-step process: inline the > > function to produce somethig equivalent to a handwritten scalar > > sub-SELECT, and then try to convert sub-SELECTs into joins. >=20 > ... back to my original question ... >=20 > What kind of query should I use ? > Is a join better than a function ? It appears that JOINs are usually faster. So if performance is an important issue, go with JOIN (and VIEWs probably). Functions are nicer (in terms off look and feel). Regards, Dawid