From: Richard Huxton <dev@archonet.com>
To: Mindaugas Riauba <mind@bi.lt>
To: pgsql-performance@postgresql.org
Subject: Re: Need advice about triggers
Date: Tue, 9 Sep 2003 14:14:23 +0100
Message-ID: <200309091414.23458.dev@archonet.com> (raw)
In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt>
References: <00be01c376cf$91510620$f20214ac@bite.lt>
On Tuesday 09 September 2003 13:40, Mindaugas Riauba wrote:
> Hello,
>
> I have small table (up to 10000 rows) and every row will be updated
> once per minute. Table also has "before update on each row" trigger
> written in plpgsql. But trigger 99.99% of the time will do nothing
> to the database. It will just compare old and new values in the row
> and those values almost always will be identical.
>
> Now I tried simple test and was able to do 10000 updates on 1000
> rows table in ~30s. That's practically enough but I'd like to have
> more room to slow down.
> Also best result I achieved by doing commit+vacuum every ~500
> updates.
>
> How can I improve performance and will version 7.4 bring something
> valuable for my task? Rewrite to some other scripting language is not
> a problem. Trigger is simple enough.
Well, try it without the trigger. If performance improves markedly, it might
be worth rewriting in C.
If not, you're probably saturating the disk I/O - using iostat/vmstat will let
you see what's happening. If it is your disks, you might see if moving the
WAL onto a separate drive would help, or check the archives for plenty of
discussion about raid setups.
> Postgres v7.3.4, shared_buffers=4096 max_fsm settings also bumped up
> 10 times.
Well effective_cache_size is useful for reads, but won't help with writing.
You might want to look at wal_buffers and see if increasing that helps, but I
couldn't say for sure.
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, mind@bi.lt
Subject: Re: Need advice about triggers
In-Reply-To: <200309091414.23458.dev@archonet.com>
References: <00be01c376cf$91510620$f20214ac@bite.lt> <200309091414.23458.dev@archonet.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