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 668FF539B4 for ; Sun, 17 Apr 2005 03:06:11 -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 69137-10 for ; Sun, 17 Apr 2005 06:06:06 +0000 (GMT) Received: from metux.de (seven.metux.de [193.16.1.1]) by svr1.postgresql.org (Postfix) with ESMTP id 0F1B6539CB for ; Sun, 17 Apr 2005 03:06:04 -0300 (ADT) Received: (from weigelt@localhost) by metux.de (8.12.10/8.12.10) id j3H664KQ024182 for pgsql-performance@postgresql.org; Sun, 17 Apr 2005 08:06:04 +0200 Date: Sun, 17 Apr 2005 08:06:04 +0200 From: Enrico Weigelt To: pgsql-performance@postgresql.org Subject: Re: immutable functions vs. join for lookups ? Message-ID: <20050417060603.GA23283@nibiru.borg.metux.de> Reply-To: weigelt@metux.de Mail-Followup-To: pgsql-performance@postgresql.org References: <20050415205511.GB20345@nibiru.borg.metux.de> <6776.1113599567@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6776.1113599567@sss.pgh.pa.us> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/376 X-Sequence-Number: 11773 * Tom Lane wrote: > Enrico Weigelt writes: > > c) CREATE FUNCTION id2username(oid) RETURNS text > > LANGUAGE 'SQL' IMMUTABLE AS ' > > SELECT username AS RESULT FROM users WHERE uid = $1'; > > This is simply dangerous. The function is *NOT* immutable (it is > stable though). When ... not if ... your application breaks because > you got the wrong answers, you'll get no sympathy from anyone. In my case it is immutable. The username never changes. cu -- --------------------------------------------------------------------- Enrico Weigelt == metux IT service phone: +49 36207 519931 www: http://www.metux.de/ fax: +49 36207 519932 email: contact@metux.de cellphone: +49 174 7066481 --------------------------------------------------------------------- -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops -- ---------------------------------------------------------------------