pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <andrew@libertyrms.info>
To: pgsql-admin@postgresql.org
Subject: Re: Row locking during UPDATE
Date: Fri, 12 Sep 2003 09:32:55 -0400
Message-ID: <20030912133255.GC26074@libertyrms.info> (raw)
In-Reply-To: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com>
References: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com>

I didn't see any response to this.  Sorry if this is already stale
for you.

On Thu, Sep 04, 2003 at 08:21:17AM -0400, David F. Skoll wrote:
> Questions:
> 
> 1) Am I on the right track?  Is this how PostgreSQL works?

More or less, yes.  The significant part here is that the postmaster
won't notice that the client is gone until it returns from the work
it was trying to do.  It'll eventually come back, but it'll take some
time.  How low does your contention need to be?

> A statistics update looks like this:
> 
> UPDATE low_contention_stats SET value = value + 1
> 	WHERE date = current_date AND key = 'KEY'
> 	AND randomizer = my_random_val AND not summarized;
> (If the update updates 0 rows, we do an INSERT)
> 
> The summary process when we copy to statistics looks like this:

If you're going to summarise anyway, why not just always insert into
a "holding" table, and then periodically (infrequently, though)
select out of there and summarise at that point.  Note that if you do
this very frequently, and you have also to select the summary data,
it won't work (as I have learned from painful experience) because
the holding table will gradually build up a lot of dead tuples.

A

-- 
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110




view thread (9+ messages)  latest in thread

Message-ID: <20030912133255.GC26074@libertyrms.info>
Permalink:  ../20030912133255.GC26074@libertyrms.info/
Also on:    postgresql.org/message-id/20030912133255.GC26074@libertyrms.info

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: andrew@libertyrms.info
  Subject: Re: Row locking during UPDATE
  In-Reply-To: <20030912133255.GC26074@libertyrms.info>
  References: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com> <20030912133255.GC26074@libertyrms.info>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox