Re: problems with transaction blocks - Mailing list pgsql-general

From Vivek Khera
Subject Re: problems with transaction blocks
Date
Msg-id x7isjmyufq.fsf@yertle.int.kciLink.com
Whole thread Raw
In response to problems with transaction blocks  ("Chris Ochs" <chris@paymentonline.com>)
List pgsql-general
>>>>> "BW" == Bruno Wolff, <Bruno> writes:

BW> Currently there is no provision for recovery from error by the application
BW> inside a transaction. What you can do is have the application check for
BW> problems before trying the insert. Depending on the problems you expect,

I have an application that does this.  First it attempts to do a mass
number of inserts based on some external events all inside a
transaction.  If we abort due to referential integrity constraint
violation, we restart the whole process but before each insert a check
is done to see if the required FK's are satisfied.

This gives us the benefit of 99% of the time when the FKs are ok we
zip along pretty darned fast, and for the 1% of the time when some
stale data is re-injected into the stream, we just restart that batch
and pay the penalty for it.

The benefit of being able to do all the inserts within a single
begin/end cannot be understated.


--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD  +1-301-869-4449 x806
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/

pgsql-general by date:

Previous
From: Vivek Khera
Date:
Subject: Re: problems with transaction blocks
Next
From: "Andrew Bartley"
Date:
Subject: Re: beginner query help