Davide Copelli wrote:

> On a Mysql database of 60000 records performs better :
> 
> my $sth = $dbh->prepare(qq|SELECT count(id) FROM log WHERE (field1 = ? and
> field2= ? )|);
> $sth->execute( $a1, $a2 );
> $total = $sth->fetchrow_array();
> 
> or
> 
> my $sth = $dbh->prepare(qq|SELECT id FROM log WHERE (field1 = ? and
> field2= ? )|);
> $sth->execute( $a1, $a2 );
> $total = $sth->rows;
> 
> where "id" is a primary key field
> 
> Thanks
> david

i bet the first one will be faster especially if id is the primary key. most 
DBMS will be able to optimize the query to a level where it's really fast.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to