Charles K. Clarkson [CKC], on Friday, November 26, 2004 at 05:30
(-0600) has on mind:
CKC> It would be slower and less accurate. To use your
CKC> suggestion would require another query on the database.
CKC> That count might also not return the same count as is
CKC> in "scalar @$rows" if the database is updated between
CKC> queries.
hm, I did some benchmarks and it seems I'm right, I use something
like:
...
$start = new Benchmark;
for (1 .. 1000) {
$sth = $dbh->prepare_cached('SELECT COUNT(sessionid) FROM session');
$sth->execute();
$result = $sth->fetchrow_array();
$sth->finish;
}
$end = new Benchmark;
$diff = timediff($end, $start);
print "Time taken was ", timestr($diff, 'all'), " seconds\n\n";
...
and it was definitely faster, than your suggestion. Did you try some
benchmarking ?
--
...m8s, cu l8r, Brano.
[I am a person of color: My color is White]
-=x=-
Skontrolovan� antiv�rov�m programom NOD32
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>