Re: slow pg_connect()

From: Thomas Pundt <mlists(at)rp-online(dot)de>
To: firerox(at)centrum(dot)cz, pgsql-performance(at)postgresql(dot)org
Subject: Re: slow pg_connect()
Date: 2008-03-24 12:39:43
Message-ID: 47E7A10F.5060805@rp-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

firerox(at)centrum(dot)cz schrieb:
> Please, how long takes your connectiong to postgres?
>
> $starttimer=time()+microtime();
>
> $dbconn = pg_connect("host=localhost port=5432 dbname=xxx user=xxx password=xxx")
> or die("Couldn't Connect".pg_last_error());
>
> $stoptimer = time()+microtime();
> echo "Generated in ".round($stoptimer-$starttimer,4)." s";
>
> It takes more then 0.05s :(
>
> Only this function reduce server speed max to 20request per second.

Two hints:
* Read about configuring and using persistent database connections
(http://www.php.net/manual/en/function.pg-pconnect.php) with PHP
* Use a connection pooler such as pgpool-II
(http://pgpool.projects.postgresql.org/)

Using both techniques together should boost your performance.

Ciao,
Thomas

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message petchimuthu lingam 2008-03-24 13:05:51 waiting for harddisk
Previous Message PFC 2008-03-24 11:23:29 Preparing statements on connection startup