cough ok, I like experiments, expecially when they prove me right! :-)
$db_connection_id=mysql_connect("db","user","pw");
// first query to get the database's attention
$a=microtime();
mysql_query("select id from table where id=45000",$db_connection_id);
mysql_query("select count(*) from table where id=45000",$db_connection_id);
$b=microtime();
$aa=split(" ",$a);
$bb=split(" ",$b);
echo (($bb[1]+$bb[0])-($aa[1]+$aa[0]));
echo "\n";
$a=microtime();
for ($t=0;$t<1000;$t++)
{
mysql_query("select count(*) from table where id=45000",$db_connection_id);
}
$b=microtime();
$aa=split(" ",$a);
$bb=split(" ",$b);
echo "count: ".(($bb[1]+$bb[0])-($aa[1]+$aa[0]));
echo "\n";
$a=microtime();
for ($t=0;$t<1000;$t++)
{
mysql_query("select id from table where id=45000",$db_connection_id);
};
$b=microtime();
$aa=split(" ",$a);
$bb=split(" ",$b);
echo "select:".(($bb[1]+$bb[0])-($aa[1]+$aa[0]));
echo "\n";
and the outcome:
count: 0.31748104095459
select:0.30682599544525
so in my case, using count is actually slower than selecting the data.
So poo to you with knobs on :-)