Re: how many record versions

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how many record versions
Date: 2004-05-23 15:52:37
Message-ID: 20040523155237.GB25716@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, May 23, 2004 at 02:44:31 +0700,
David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com> 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-05-23 15:54:48 Re: how many record versions
Previous Message Bruno Wolff III 2004-05-23 15:49:59 Re: DB design opinions - Foreign Key usage