Skip site navigation (1) Skip section navigation (2)

Re: slow pg_connect()

From: "vincent" <vinny(at)xs4all(dot)nl>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: slow pg_connect()
Date: 2008-03-24 08:35:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
> It takes more then 0.05s :(
> Only this function reduce server speed max to 20request per second.

First, benchmarking using only PHP is not very accurate, you're probably
also measuring some work that PHP needs to do just to get started in the
first place.

Second, this 20r/s is not requests/sec but connections per second per PHP
script. One pageview in PHP needs one connection, so it will delay the
pageview by 0.05 seconds.

If you need raw speed, you can use pg_pconnect(), but be VERY carefull
because that will keep one databaseconnection open for every database for
every webserverprocess. If you have 10 databasedriven websites running on
the same webserver and that server is configured to run 100 processes at
the same time, you will get 10x100=1000 open connections, which eats more
RAM than you have.

pgsql-performance by date

Next:From: petchimuthu lingamDate: 2008-03-24 09:27:59
Subject: increasing shared buffer slow downs query performance.
Previous:From: Craig RingerDate: 2008-03-24 08:04:23
Subject: Re: slow pg_connect()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group