Re: Persistent connections in PHP

From: Hannes Dorbath <light(at)theendofthetunnel(dot)de>
To: Dmitry Koterov <dmitry(at)koterov(dot)ru>
Subject: Re: Persistent connections in PHP
Date: 2007-08-15 07:32:04
Message-ID: 46C2ABF4.9060102@theendofthetunnel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14.08.2007 23:13, Dmitry Koterov wrote:
> Pconnects are absolutely necessary if we use tsearch2, because it
> initializes its dictionaries on a first query in a session. It's a very
> heavy process (500 ms and more). So, if we do not use pconnect, we waste
> about 500 ms on each DB connection. Too much pain.

We've been using pconnect for exactly the same reason. Though startup
time for our dictionary is even higher (around 2 seconds). The problem
is that persistent connections in PHP are not clean implemented, they
can get randomly garbage collected. The problem seems well known, though
I'm unaware of any fix. I think it's best to use pgbouncer and plain
connect ATM. Additionally, as mentioned earlier, using pconnect under
the Apache webserver is not a good idea at all, at least not with it's
current architecture.

--
Regards,
Hannes Dorbath

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alain Roger 2007-08-15 08:08:36 check if database is correctly created
Previous Message Sabin Coanda 2007-08-15 07:21:31 memory optimization