Re: Trouble with Savepoints in postgres - Mailing list pgsql-general

From Craig Ringer
Subject Re: Trouble with Savepoints in postgres
Date
Msg-id 47DC1423.7000508@postnewspapers.com.au
Whole thread Raw
In response to Re: Trouble with Savepoints in postgres  (sam <sam.mahindrakar@gmail.com>)
List 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Trouble with Savepoints in postgres
Next
From: Clodoaldo
Date:
Subject: Re: Reindex does not finish 8.2.6