"Expiring" transactions?

Started by Egor Shipovalovover 22 years ago6 messagesgeneral
Jump to latest
#1Egor Shipovalov
pgsql_list@eonline.ru

Is there a way to make transaction automatically COMMIT or ROLLBACK after
certain period of time?
I want website visitors to be able to page through search results using
single cursor. Since users can leave the site at any time, I can't know when
to end their transaction.

I guess I can write a broker that gives each user a connection and tracks
when he's gone, performing necessaty cleanup, but isn't there a simplier
way?

Best regards,
Egor Shipovalov.

#2Mark Kirkwood
mark.kirkwood@catalyst.net.nz
In reply to: Egor Shipovalov (#1)
Re: "Expiring" transactions?

Most web appl servers have settings to do this for you, or APIs you can
use.

e.g. for J2EE see SessionBindingListener

regards

mark

Egor Shipovalov wrote:

Show quoted text

Is there a way to make transaction automatically COMMIT or ROLLBACK after
certain period of time?
I want website visitors to be able to page through search results using
single cursor. Since users can leave the site at any time, I can't know when
to end their transaction.

I guess I can write a broker that gives each user a connection and tracks
when he's gone, performing necessaty cleanup, but isn't there a simplier
way?

Best regards,
Egor Shipovalov.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

#3Bruce Momjian
bruce@momjian.us
In reply to: Egor Shipovalov (#1)
Re: "Expiring" transactions?

Egor Shipovalov wrote:

Is there a way to make transaction automatically COMMIT or ROLLBACK after
certain period of time?
I want website visitors to be able to page through search results using
single cursor. Since users can leave the site at any time, I can't know when
to end their transaction.

I guess I can write a broker that gives each user a connection and tracks
when he's gone, performing necessaty cleanup, but isn't there a simplier
way?

We have statement_timeout, but not transaction_timeout.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Gaetano Mendola
mendola@bigfoot.com
In reply to: Bruce Momjian (#3)
Re: "Expiring" transactions?

Bruce Momjian wrote:

Egor Shipovalov wrote:

Is there a way to make transaction automatically COMMIT or ROLLBACK after
certain period of time?
I want website visitors to be able to page through search results using
single cursor. Since users can leave the site at any time, I can't know when
to end their transaction.

I guess I can write a broker that gives each user a connection and tracks
when he's gone, performing necessaty cleanup, but isn't there a simplier
way?

We have statement_timeout, but not transaction_timeout.

Could be nice have it, once I forgot to do a commit and I
left my desk, the day after all the DB was hanged by that opened
transaction.

Regards
Gaetano Mendola.

#5Shridhar Daithankar
shridhar_daithankar@persistent.co.in
In reply to: Gaetano Mendola (#4)
Re: "Expiring" transactions?

Gaetano Mendola wrote:

Bruce Momjian wrote:

We have statement_timeout, but not transaction_timeout.

Could be nice have it, once I forgot to do a commit and I
left my desk, the day after all the DB was hanged by that opened
transaction.

Probably it could detect idle time and disconnect.. That could be used to roll
back automatically..

Shridhar

#6Nigel J. Andrews
nandrews@investsystems.co.uk
In reply to: Shridhar Daithankar (#5)
Re: "Expiring" transactions?

On Thu, 25 Sep 2003, Shridhar Daithankar wrote:

Gaetano Mendola wrote:

Bruce Momjian wrote:

We have statement_timeout, but not transaction_timeout.

Could be nice have it, once I forgot to do a commit and I
left my desk, the day after all the DB was hanged by that opened
transaction.

Probably it could detect idle time and disconnect.. That could be used to roll
back automatically..

I'd be unhappy with the commit part of the original request for commit or
rollback and in the first instance wouldn't this be a candidate for the client
app. to perform?

Obviously the server may not detect if the client just goes away, unless
keepalive is on, but only the client knows that the user isn't waving the mouse
around the screen looking for that bit of information needed to complete the
query underconstruction.

--
Nigel J. Andrews