PostgreSQL client api - Mailing list pgsql-general

From Antimon
Subject PostgreSQL client api
Date
Msg-id 1143594105.124153.294320@i39g2000cwa.googlegroups.com
Whole thread Raw
Responses Re: PostgreSQL client api  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: PostgreSQL client api  ("paul rivers" <privers@berkeley.edu>)
Re: PostgreSQL client api  (Scott Marlowe <smarlowe@g2switchworks.com>)
Re: PostgreSQL client api  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-general
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.


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: best practice in upgrading db structure
Next
From: "Jim C. Nasby"
Date:
Subject: Re: PostgreSQL client api