Search Postgresql Archives

Re: Apache + PHP + Postgres Interaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 23, 2007, at 12:29 PM, Bill Moran wrote:

In response to "Joshua D. Drake" <jd@xxxxxxxxxxxxxxxxx>:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Max Zorloff wrote:
Hello.

I have a subject setup and a few questions.

The first one is this. PHP establishes a connection to the Postgres
database through pg_pconnect().

Don't use pconnect. Use pgbouncer or pgpool.

Then it
runs some query, then the script returns, leaving the persistent
connection hanging. But the trouble
is that in this case any query takes significantly more time to execute
than in the case of one PHP script
running the same query with different parameters for N times. How can I
achieve the same performance in the first
case? Persistent connections help but not enough - the queries are still
10 times slower than they would be on
the 2nd time.

Well you haven't given us any indication of data set or what you are
trying to do. However, I can tell you, don't use pconnect, its broke ;)

Broke?  How do you figure?

I'm not trying to argue the advantages of a connection pooler such as
pgpool, but, in my tests, pconnect() does exactly what it's supposed
to do: reuse existing connections.  In our tests, we saw a 2x speed
improvement over connect().  Again, I understand that pgpool will do
even better ...

We were just talking about this less than two weeks ago: http:// archives.postgresql.org/pgsql-general/2007-08/msg00660.php

Erik Jones

Software Developer | Emma®
erik@xxxxxxxxxx
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux