Re: Persistent Connections in Webserver Environment

From: Hannes Dorbath <light(at)theendofthetunnel(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Persistent Connections in Webserver Environment
Date: 2005-05-02 15:32:07
Message-ID: 42764126$0$24351$8fe63b2a@news.disputo.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02.05.2005 16:41, Marco Colombo wrote:

> Have you measured the real gain in using persistent connections at all?

As simple as possible:

<?php
require_once('Benchmark/Timer.php');
$timer =& new Benchmark_Timer();
$timer->start();

pg_pconnect('host=myhost dbname=database user=user');
pg_query("SET search_path TO myschema;");

$q = "SELECT u.login FROM users WHERE u.user_id = 1;";

$qr = pg_query($q);

print_r(pg_fetch_all($qr));

$timer->setMarker('Database');
$timer->stop();
$timer->display();
?>

Results:

pconnect: 0.001435995101928
connect: 0.016793966293335

It's factor 10 on such simple things on the BSD box.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hannes Dorbath 2005-05-02 15:40:05 Re: Persistent Connections in Webserver Environment
Previous Message Hannes Dorbath 2005-05-02 15:05:49 Re: Persistent Connections in Webserver Environment