in reply to DBI: Better way to find number of rows in a table?
just as a note under mySQL I would use limit rather than count. eg.
my $sth = $dbh->prepare("select * from $table limit 1"); $sth->execute(); print "Theres at least 1 row" if $sth->rows();
That way you don't have to look through the whole table to create the result ( although it's possible that is optimized)
note: untestedUpdate: mahi's note below shows just why one should be careful about premature optimization. heh.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: DBI: Better way to find number of rows in a table?
by rnahi (Curate) on Jun 04, 2003 at 09:29 UTC |