Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 86A759F9C77; Mon, 13 Aug 2007 19:18:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 82472-06; Mon, 13 Aug 2007 19:18:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 9DBBC9F9C4E; Mon, 13 Aug 2007 19:17:54 -0300 (ADT) Received: from [192.168.42.113] (natpool.bovine.net [67.100.216.14]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by noel.decibel.org (Postfix) with ESMTP id 2D2B5564AD; Mon, 13 Aug 2007 17:17:37 -0500 (CDT) In-Reply-To: <46BDC091.4090109@commandprompt.com> References: <20070808124054.GC27936@nibiru.local> <46BD687E.1040100@enterprisedb.com> <46BDC091.4090109@commandprompt.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6F774767-8871-45DC-AE31-FD3D7A5A2F46@decibel.org> Cc: Heikki Linnakangas , pgsql-sql , postgresql performance list Content-Transfer-Encoding: 7bit From: Jim Nasby Subject: Re: Performance on writable views Date: Mon, 13 Aug 2007 17:17:16 -0500 To: Joshua D. Drake X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/144 X-Sequence-Number: 26274 On Aug 11, 2007, at 8:58 AM, Joshua D. Drake wrote: > Heikki Linnakangas wrote: >> Enrico Weigelt wrote: >>> I'm often using writable views as interfaces to clients, so >>> they only see "virtual" objects and never have to cope with >>> the actual storage, ie. to give some client an totally >>> denormalized view of certain things, containing only those >>> information required for certain kind of operations. > >>> Now I've got the strange feeling that this makes updates >>> slow, since it always has to run the whole view query to >>> fetch an record to be updated (ie. to get OLD.*). >> >> There is some overhead in rewriting the query, but it shouldn't be >> significantly slower than issuing the statements behind the view >> directly. I wouldn't worry about it, unless you have concrete >> evidence >> that it's causing problems. > > I don't know about that, at least when using rules for partitioning > the > impact can be significant in comparison to triggers. That's because you have to re-evaluate the input query for each rule that's defined, so even if you only have rules for 2 partitions in a table (which is really about the minimum you can have, at least for some period of overlap surrounding the time when you switch to a new partition), you're looking at evaluating every input query twice. In this case, the rules presumably are just simply re-directing DML, so there'd only be one rule in play at a time. That means the only real overhead is in the rewrite engine. -- Decibel!, aka Jim Nasby decibel@decibel.org EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)