Re: PostgreSQL client api

From: "paul rivers" <privers(at)berkeley(dot)edu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL client api
Date: 2006-03-29 01:11:59
Message-ID: 011901c652cd$c7e8e4a0$06d09888@parzifal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Try factoring the connect time out of the test. My experience is the
connect is more expensive for Postgres than MySQL. With that out of the
way, I'd wager the times will be closer.
Regards,
Paul

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Antimon
Sent: Tuesday, March 28, 2006 5:02 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] PostgreSQL client api

Hi,
I was testing MySQL and PgSQL performances on my home box (amd athlon
64 3000, 1gig ddr ram, sata I hdd, win xp (x86)), select and insert
times seeemed identical with innoDB.

But when i try to query both using php, there's a huge difference even
for a funny query like "select 1"

Here's the code:

<?php
$mtime = microtime(true);

$pdo = new PDO('pgsql:host=localhost;dbname=test', "testacc", "pw");
for ($i = 0; $i < 10000; $i++)
{
$result = $pdo->query("Select "+$i);
}

echo microtime(true) - $mtime;
echo "<br>";

$mtime = microtime(true);

$pdo = new PDO('mysql:host=localhost;dbname=test', "testacc", "pw");
for ($i = 0; $i < 10000; $i++)
{
$result = $pdo->query("Select "+$i);
}

echo microtime(true) - $mtime;
echo "<br>";
?>

output is:
2.7696590423584
0.89393591880798

Nearly 3 times slower even w/o any table queries. But i could not
reproduce this by writing stored procs on both which selects 0-10000 in
a loop to a variable. results were almost same.
(I tried pg_ and mysqli_ functions too, results were not too different)

Is it mysql client libraries performs better? Or postgre stored procs
are 3x faster? I cannot understand, since there is not even an io
operation or any query planning stuff, what is the cause of this?

Thanks.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2006-03-29 01:26:07 Re: PostgreSQL client api
Previous Message Jim C. Nasby 2006-03-29 01:06:13 Re: PostgreSQL client api