Re: Trouble with Savepoints in postgres

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: sam <sam(dot)mahindrakar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trouble with Savepoints in postgres
Date: 2008-03-15 18:23:31
Message-ID: 47DC1423.7000508@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sam wrote:

> FUNCTION UPDATE ()
> BEGIN
> UPDATE statement
>
> EXCEPTION
> END
>
>
> when one record fails data only for that is rolled back the rest of
> the data is saved. EXCEPTION has to be caught.
>
>
As I recently found out, too many savepoints really kill PostgreSQL's
performance in a transaction. A function inserting/updating, say,
100,000 records will perform OK, but statements run in the same
transaction after the function completes will be very slow.

So ... if you find that after your big update statement performance is
terrible, you might need to explicitly check the conditions that might
result in an exception and skip those records, thus avoiding the
EXCEPTION block.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Clodoaldo 2008-03-15 18:56:25 Re: Reindex does not finish 8.2.6
Previous Message Tom Lane 2008-03-15 17:03:15 Re: Trouble with Savepoints in postgres