pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <andrew@libertyrms.info>
To: pgsql-performance@postgresql.org
Subject: Re: for help!
Date: Wed, 16 Apr 2003 11:53:12 -0400
Message-ID: <20030416155312.GF19999@libertyrms.info> (raw)
In-Reply-To: <200304160848.36431.josh@agliodbs.com>
References: <Pine.LNX.4.33.0304151032440.18680-100000@css120.ihs.com>
	<200304160848.36431.josh@agliodbs.com>

On Wed, Apr 16, 2003 at 08:48:36AM -0700, Josh Berkus wrote:
> Scott,
> 
> > Well, you can always use the trick of putting an on insert / delete
> > trigger on the table that maintains a single row table with the current
> > count.  That way, whenever a row is added or removed, the count is

> BTW, I tested this for a client.   I found the performance penalty
> on inserts and updates to be:

[. . .]

> Please note that the effective performance penalty on inserts and
> updates was dramatically higher for large batches of updates than
> for small ones.

Presumably the problem was to do with contention?  This is why I
don't really like the "update one row" approach for this sort of
thing.

But you _could_ write a trigger which inserts into a "staging" table,
and write a little daemon which only updates the count table with the
data from the staging table.  It's a mighty ugly hack, but it ought
to work.

A

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




view thread (8+ messages)  latest in thread

Message-ID: <20030416155312.GF19999@libertyrms.info>
Permalink:  ../20030416155312.GF19999@libertyrms.info/
Also on:    postgresql.org/message-id/20030416155312.GF19999@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-performance@postgresql.org
  Cc: andrew@libertyrms.info
  Subject: Re: for help!
  In-Reply-To: <20030416155312.GF19999@libertyrms.info>
  References: <Pine.LNX.4.33.0304151032440.18680-100000@css120.ihs.com> <200304160848.36431.josh@agliodbs.com> <20030416155312.GF19999@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