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 4C44152A54 for ; Fri, 18 Mar 2005 09:10:12 +0000 (GMT) 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 60904-06 for ; Fri, 18 Mar 2005 09:10:02 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id EFDF052A50 for ; Fri, 18 Mar 2005 09:10:00 +0000 (GMT) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j2HLRXQF006382; Thu, 17 Mar 2005 23:27:34 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j2HLRQfA006381; Thu, 17 Mar 2005 23:27:26 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: One tuple per transaction From: Hannu Krosing To: Josh Berkus Cc: Tambet Matiisen , pgsql-performance@postgresql.org In-Reply-To: <200503121405.20943.josh@agliodbs.com> References: <200503121405.20943.josh@agliodbs.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 17 Mar 2005 23:27:25 +0200 Message-Id: <1111094845.6281.1.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-1) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/367 X-Sequence-Number: 11072 On L, 2005-03-12 at 14:05 -0800, Josh Berkus wrote: > Tambet, > > > In one of our applications we have a database function, which > > recalculates COGS (cost of good sold) for certain period. This involves > > deleting bunch of rows from one table, inserting them again in correct > > order and updating them one-by-one (sometimes one row twice) to reflect > > current state. The problem is, that this generates an enormous amount of > > tuples in that table. > > Sounds like you have an application design problem ... how about re-writing > your function so it's a little more sensible? Also, you could at least use a temp table for intermediate steps. This will at least save WAL traffic. -- Hannu Krosing