Re: Number of connections - Mailing list pgsql-php

From Ernest E Vogelsinger
Subject Re: Number of connections
Date
Msg-id 5.1.1.6.2.20030523190006.0318cca0@mail.vogelsinger.at
Whole thread Raw
In response to Re: Number of connections  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-php
At 17:45 23.05.2003, scott.marlowe said:
--------------------[snip]--------------------
>...
>The problem with keep alive is that apache has a short attention span,
>since the default timeout for keep alives is 15 seconds.  Let's say user A
>opens a web page with a form, and edits it for 3 minutes.  His keep alive
>connection is gone.  While it is still very likely that his next request
>will be serviced by the same child as the last time, there is NOT
>guarantee.
--------------------[snip]--------------------

I've read in another thread (either here, or in php-general) that PHP
clears out any transactions that might be open when you pg_connect() or
ph_pconnect(), by issuing "begin;rollback;".

If this is the case this would mean you simply CANNOT have transactions
open across multiple requests.

Which is a good thing IMHO. Just think of the mess that would be created if
client A opens a transaction, client B (using the same child process,
pg_pconnect()ing to the same database) runs a totally different set of
instructions and commits the transaction. A's "transaction" would be
partially committed by B...

Transactions are designed to be atomic operations, and I strongly believe
they should be treated exactly this way - begin, do your stuff, commit or
rollback. In one request. Anyway, pending transactions may lock rows or
tables, and may keep other parts of an application from running at all.

Just my 2c worth...

--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



pgsql-php by date:

Previous
From: Frank Bax
Date:
Subject: Re: faster output from php and postgres
Next
From: "Lonnie VanZandt"
Date:
Subject: Re: faster output from php and postgres