pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Pundt <mlists@rp-online.de>
To: firerox@centrum.cz
To: pgsql-performance@postgresql.org
Subject: Re: slow pg_connect()
Date: Mon, 24 Mar 2008 13:39:43 +0100
Message-ID: <47E7A10F.5060805@rp-online.de> (raw)
In-Reply-To: <200803240840.8128@centrum.cz>
References: <200803240840.8128@centrum.cz>

Hi,

firerox@centrum.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



view thread (7+ messages)  latest in thread

Message-ID: <47E7A10F.5060805@rp-online.de>
Permalink:  ../47E7A10F.5060805@rp-online.de/
Also on:    postgresql.org/message-id/47E7A10F.5060805@rp-online.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mlists@rp-online.de, firerox@centrum.cz
  Subject: Re: slow pg_connect()
  In-Reply-To: <47E7A10F.5060805@rp-online.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox