X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 31BEBD1B345 for ; Sun, 23 May 2004 12:47:46 -0300 (ADT) 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 57779-01 for ; Sun, 23 May 2004 12:47:26 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 631ACD1B21B for ; Sun, 23 May 2004 12:47:25 -0300 (ADT) Received: (qmail 25806 invoked by uid 500); 23 May 2004 15:52:37 -0000 Date: Sun, 23 May 2004 10:52:37 -0500 From: Bruno Wolff III To: David Garamond Cc: pgsql-general@postgresql.org Subject: Re: how many record versions Message-ID: <20040523155237.GB25716@wolff.to> Mail-Followup-To: David Garamond , pgsql-general@postgresql.org References: <40AFAD9F.6000104@zara.6.isreserved.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40AFAD9F.6000104@zara.6.isreserved.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/710 X-Sequence-Number: 61144 On Sun, May 23, 2004 at 02:44:31 +0700, David Garamond wrote: > begin; > update t set val=val+1; -- 1000 times > commit; > > How many record versions does it create? 1 or 1000? I'm implementing a > banner counter which is incremented at least 2-3 millions a day. I > thought I'd cheat by only commiting after every few minutes. Would that > work or would I still create as many record versions? You might be better off keeping the counter in its own table and vacuuming that table very often. It is unlikely that holding transactions open for several minutes is a good idea. Also if you are doing multiple updates in a single transaction, you are still going to get multiple rows.