Search Postgresql Archives

Re: Apache + PHP + Postgres Interaction

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

 



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

> 
> The second one is that the machine with this setup is dual core Xeon
> 2.8ghz. I've read somewhere about
> the switching context problem and bad postgres performance. What are the
> effects? What are the symptoms?

You likely do not have this problem if you are running anywhere near a
current PostgreSQL release but you can check it with vmstat.

> And what will be the performance gain if I change the machine to equal
> Athlon?

Depends on the work load.

Sincerely,

Joshua D. Drake


> 
> Thank you in advance.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
> 


- --

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997  http://www.commandprompt.com/
			UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzcEAATb/zqfZUUQRAkkEAKCc00kZu6YSDp1RWjY9zZeQVEYeVACeIsOl
hzyHOnynNSNWOrBakMeVKpc=
=LL5i
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[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