Re: PREPARE TRANSACTION and webapps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PREPARE TRANSACTION and webapps
Date: 2005-11-10 21:11:04
Message-ID: 11916.1131657064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my> writes:
> Is it OK to use PREPARE TRANSACTION and COMMIT PREPARED in order to have
> transactions that last longer than just a single web request?

> Previously it was usually a bad idea to keep database connections alive
> just to keep a transaction pending.

A prepared transaction eats just about the same resources (other than an
active connection) as a live one. In particular it still holds its
locks, which makes leaving it around for a long time just as evil as
simply sitting on it in an un-prepared state.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-11-10 21:23:22 Re: Locale/Indexing
Previous Message Hugo 2005-11-10 20:53:55 run vacuum from within a function