pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michal Szymanski <szymanskim@datera.pl>
Cc: pgsql-performance@postgresql.org
Subject: Re: Big problem with sql update operation
Date: Fri, 25 May 2007 10:28:38 -0400
Message-ID: <8751.1180103318@sss.pgh.pa.us> (raw)
In-Reply-To: <4656A4E0.7020400@datera.pl>
References: <4656A4E0.7020400@datera.pl>

Michal Szymanski <szymanskim@datera.pl> writes:
> CREATE OR REPLACE FUNCTION test()
> RETURNS void AS
> $BODY$
> DECLARE
> BEGIN  
> FOR v_i IN 1..4000 LOOP
>     UPDATE group_fin_account_tst SET
>             credit     = v_i
>          WHERE group_fin_account_tst_id = 1;   -- for real procedure I 
> update different rows

Does updating the *same* record 4000 times per transaction reflect the
real behavior of your application?  If not, this is not a good
benchmark.  If so, consider redesigning your app to avoid so many
redundant updates.

(For the record, the reason you see nonlinear degradation is the
accumulation of tentatively-dead versions of the row, each of which has
to be rechecked by each later update.)

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <8751.1180103318@sss.pgh.pa.us>
Permalink:  ../8751.1180103318@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8751.1180103318@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, szymanskim@datera.pl
  Subject: Re: Big problem with sql update operation
  In-Reply-To: <8751.1180103318@sss.pgh.pa.us>

* 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