Re: PREPARE TRANSACTION and webapps

From: "Guy Rouillier" <guyr(at)masergy(dot)com>
To: "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PREPARE TRANSACTION and webapps
Date: 2005-11-17 00:04:57
Message-ID: CC1CF380F4D70844B01D45982E671B239E8C99@mtxexch01.add0.masergy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

gsstark(at)mit(dot)edu wrote:

> I take it as a given that if suspended transactions were ever to
> appear people would expect a system table that let them list
> suspended transactions and how when they were suspended. Otherwise
> they just wouldn't be very manageable.

Regarding web applications, this turns out not to be too hard of a
problem to solve. Using the two options I identified: if you are able
to keep all your transaction data in the web server session, then this
data just disappears when the session goes away. No clean up necessary.
If you maintain state in a set of database tables, most implementations
assume that if the transaction ages past some threshold value (e.g., one
hour) without completion, the submitter decided not to complete. So you
just run a cron job once an hour that sweeps through these tables and
deletes anything older than the threshold. If you want to allow the
submitter to return at a later date and resume, then you are right, this
gets a little trickier, but not much. You still do the threshold
checking in case the submitter never returns, but you up the threshold
value to two weeks (or whatever.) And if the submitter does return, you
force him/her to resume or delete the existing transaction before they
can start a new one.

--
Guy Rouillier

Browse pgsql-general by date

  From Date Subject
Next Message Mott Leroy 2005-11-17 00:04:58 Re: Incomplete Startup Packet
Previous Message Tom Lane 2005-11-16 23:30:40 Re: Incomplete Startup Packet