X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08E8DD1D189 for ; Fri, 6 Feb 2004 07:26:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 68187-07 for ; Fri, 6 Feb 2004 03:26:30 -0400 (AST) Received: from serwer.skawsoft.com.pl (skawina.eu.org [80.48.213.66]) by svr1.postgresql.org (Postfix) with ESMTP id 05F1CD1C9AB for ; Fri, 6 Feb 2004 03:26:29 -0400 (AST) Received: from klaster.net (backbone.zab.citynet.pl [212.244.6.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id BC31E2B3D7; Fri, 6 Feb 2004 08:26:04 +0100 (CET) Message-ID: <40234227.7060209@klaster.net> Date: Fri, 06 Feb 2004 08:28:39 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.6b) Gecko/20031208 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: alvarezp@alvarezp.ods.org Cc: Lista dyskusyjna pgsql-sql Subject: [Fwd: Re: [PERFORM] Seq scan on zero-parameters function] Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/62 X-Sequence-Number: 16753 Dnia 2004-02-06 08:19, Użytkownik Octavio Alvarez napisał: > Hi! > > I'd like to know if this is expected behavior. These are two couples of > queries. In each couple, the first one has a WHERE field = function() > condition, just like the second one, but in the form WHERE field = > (SELECT function()). In my opinion, both should have the same execution > plan, as the function has no parameters and, therefore, is constant. Nope. What would you say about function without params returning timeofday()? Is it constant? If you are sure, that your function returns constant value - declare it as IMMUTABLE. (look at CREATE FUNCTION documentation) Regards, Tomasz Myrta