Hi,
On 09/15/2010 07:30 PM, Robert Haas wrote:
> One problem with autonomous transactions is that you have to figure
> out where to store all the state associated with the autonomous
> transaction and its subtransactions. Another is that you have to
> avoid an unacceptable slowdown in the tuple-visibility checks in the
> process.
It just occurs to me that this is the other potential use case for
bgworkers: autonomous transactions. Simply store any kind of state in
the bgworker and use one per autonomous transaction.
What's left to be done: implement communication between the controlling
backend (with the client connection) and the bgworker (imessages), drop
the bgworker's session to user privileges (and re-raise to superuser
after the job) and implement better error handling, as those would have
to be propagated back to the controlling backend.
Regards
Markus Wanner