count(*) VS num_rows
View Single Post
04-02-2009, 07:44 PM
Join Date: Mar 2009
Location: Springfield, IL USA
I always use count Vs using num_rows. My site uses a lot of queries, and the load on the server is fairly light given the size of my site.
Using an asterisk (*) wildcards count() to consider all fields. It does add a very small (not even noticeable) lag in the query process. However, if you only need to get count totals from a specific field, you can use just that field_name and it serves the same purpose.
I guess it all comes down to personal preferences. Some programmers like to code it one way, and others another way.
The Following User Says Thank You to WebSavvy For This Useful Post:
View Public Profile
Send a private message to WebSavvy
Find More Posts by WebSavvy