Re: mysql_num_rows speed
| From: | list at renaghan dot com | Date: | Fri, 09 Jun 2000 21:31:40 +0000 |
| Subject: | Re: mysql_num_rows speed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1454@lists.php.net to get a copy of this message | ||
* David Norman <norny@geocities.com> [Jun 9 3:55pm]:
> I'm counting some rows in mysql in a loop, so I want things to be as fast as
> possible. Anyone know which is faster?
>
> $query = mysql_query("select count(*) from table where blah='blah'");
> $thing = mysql_fetch_row($query);
>
> OR
>
> $query = mysql_query("select column from table where blah='blah'");
> $thing = mysql_num_rows($query);
>
> I'm thinking the first is, but it's nice to have a second opinion :)
Without doing any testing, I would have to say that the first
solution is faster. Less work for the database, and less data
returned over the wire.
--
Padraic Renaghan /pad-rik ren-a-han/
padraic@renaghan.com
ICQ# 9437815
http://renaghan.com/pcr