
October 12th, 1999, 07:24 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Yes and no.
Using count(*) would be faster when there is actual data returned i.e. userid is used AND the data returned is large. The fastest way would be to return a single field that contains an integer (the smaller the better) or a char(n) field where n is small (less than 5 characters). This reduces the overhead of returning large data and the overhead of mysql performing the count() function.
Using a boolean conditional is faster than a comparison.
The num_rows function is quicker than fetch_row because it returns an integer, not an array (doesn't matter that the array is one element and that element is an integer.)
|