From: Josh Berkus <josh@agliodbs.com>
To: scott.marlowe <scott.marlowe@ihs.com>
To: linweidong <wdlin@sis.sh.cn>
Cc: pgsql-performance@postgresql.org
Subject: Re: for help!
Date: Wed, 16 Apr 2003 08:48:36 -0700
Message-ID: <200304160848.36431.josh@agliodbs.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0304151032440.18680-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0304151032440.18680-100000@css120.ihs.com>
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
> updated. this will slow down inserts and deletes a little, but TANSTAAFL.
BTW, I tested this for a client. I found the performance penalty on inserts
and updates to be:
-- For a single stream of intermittent updates from a single connection
on an adequately powered server with moderate disk support (IDE Linux RAID)
(100 inserts/updates per minute, with VACUUM every 5 minutes)
PL/pgSQL Trigger: 20% penalty C Trigger: 9-11% penalty
-- For 5 streams of inserts and updates at high volume on an overloaded
server with moderate disk support (dual fast SCSI disks)
(1000 inserts/updates per minute, vacuum every 5 minutes)
PL/pgSQL Trigger: 65% penalty C Trigger: 40% penalty
Please note that the effective performance penalty on inserts and updates was
dramatically higher for large batches of updates than for small ones.
--
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com, scott.marlowe@ihs.com, wdlin@sis.sh.cn
Subject: Re: for help!
In-Reply-To: <200304160848.36431.josh@agliodbs.com>
References: <Pine.LNX.4.33.0304151032440.18680-100000@css120.ihs.com> <200304160848.36431.josh@agliodbs.com>
* 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