Re: php with postgres

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Marcus Brger <marcus(dot)boerger(at)post(dot)rwth-aachen(dot)de>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, ivan <iv(at)psycho(dot)pl>, Joe Conway <mail(at)joeconway(dot)com>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: php with postgres
Date: 2003-07-22 21:24:54
Message-ID: 200307222124.h6MLOso07713@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marcus B?rger wrote:
> Hello Jan,
>
> Tuesday, July 22, 2003, 10:57:56 PM, you wrote:
>
> JW> Bruce Momjian wrote:
> >> Marcus B?rger wrote:
> >>> However it may be very usefull to terminate any open transaction before
> >>> reusing a persisten connection. Typically this happens when the same script
> >>> runs again. But anyway using transactions together with persistent conenctions
> >>> in a multithreaded environment isn't the best thing you could do. So our
> >>> options are
> >>> 1) tell the users to do 'auto commit mode'
> >>> 2) nested transactions
> >>> 3) locking
> >>>
> >>> >From my perspective 2) and 3) are bad ideas for the web environment. In other
> >>> words i guess we should leave it as is with transaction rollback only when the
> >>> client terminates (e.g. the webserver stops).
> >>
> >> I don't see why you wouldn't just do BEGIN;COMMIT;RESET ALL; when you
> >> pass the connection to a new client.
> >>
>
> JW> Right, and I don't see why using transactions in a multithreaded
> JW> environment would be a bad idea. However an application is designed, one
> JW> logical unit of changes, called a business transaction, has to have one
> JW> database transaction modifying the business relevant information.
> JW> There could be other transactions involved for dialog handling and
> JW> advisory locking.
>
>
> So i'll update to "BEGIN;COMMIT;RESET ALL;" :-)

Yes, I think that is it. The RESET ALL has to be at the end because you
have to make sure the RESET is in a valid transaction.

The only way to make sure autocommit doesn't effect you would be to do:

BEGIN;COMMIT;BEGIN;RESET ALL;COMMIT;

but the autocommit GUC option was only in 7.3 and will not be in 7.4, so
this seems like overkill.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-22 21:26:32 autocommit in 7.4
Previous Message Marcus Brger 2003-07-22 21:05:37 Re: php with postgres