Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1CC049FC56A for ; Fri, 1 Jun 2007 15:51:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 75630-02-3 for ; Fri, 1 Jun 2007 15:51:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id EB8A99FC550 for ; Fri, 1 Jun 2007 15:51:31 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1HuCDi-0003ae-OP for pgsql-sql@postgresql.org; Fri, 01 Jun 2007 14:51:30 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 3DE59404E; Fri, 1 Jun 2007 14:51:25 -0400 (EDT) Date: Fri, 1 Jun 2007 14:51:25 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Versionning (was: Whole-row comparison) Message-ID: <20070601185125.GJ24299@phlogiston.dyndns.org> References: <473557.7523.qm@web31803.mail.mud.yahoo.com> <20070601174711.GH24299@phlogiston.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/5 X-Sequence-Number: 28495 On Fri, Jun 01, 2007 at 09:07:10PM +0300, christian.roche.ext@nsn.com wrote: > > Hi Andrew, > > I must admit I don't really understand what you say. I don't know what > SRF stand for, and what you say about generic case is not clear to me, > sorry. Sorry, it stands for set returning function. I thought someone upthread suggested that instead of a view. > and the following statement would be optimized: > > UPDATE param_table SET ver_id = xxx; > SELECT * FROM bsc_view WHERE obj_id = yyy; > > which would not be the case would I have used a multi-row function. > > Does this make sense ? Yes, but I don't think it's true. Because you change the value of ver_id all the time, the actual result can't be collapsed to a constant, so you end up having to execute the query with the additional value, and you still have to plan that. The same thing is true of a function, which will have its plan prepared the first time you execute it. (I could be wrong about this; I suppose the only way would be to try it.) A -- Andrew Sullivan | ajs@crankycanuck.ca However important originality may be in some fields, restraint and adherence to procedure emerge as the more significant virtues in a great many others. --Alain de Botton