Обсуждение: "Expiring" transactions?

Поиск
Список
Период
Сортировка

"Expiring" transactions?

От
"Egor Shipovalov"
Дата:
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.


Re: "Expiring" transactions?

От
Mark Kirkwood
Дата:
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:

>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
>
>
>
>


Re: "Expiring" transactions?

От
Bruce Momjian
Дата:
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

Re: "Expiring" transactions?

От
Gaetano Mendola
Дата:
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.


Re: "Expiring" transactions?

От
Shridhar Daithankar
Дата:
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


Re: "Expiring" transactions?

От
"Nigel J. Andrews"
Дата:
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