MySQL Forums
Forum List  »  Optimizer & Parser

Re: count(*) versus mysql_num_rows
Posted by: Paul Loy
Date: June 02, 2006 04:13AM

I agree, if all you want to do is get a count then the second one is quicker. Now my predicament is this:

I want to get all the rows anyway for displaying in a table but I also want to count them. But because I'm hacking some code (sphider to be exact) I don't think I'll be able to use the output loop to count the rows without altering the code too much.

Given this, is mysql_num_rows quicker than doing a simple count(*) which could be cached in mysql?

Note (1): the number of rows retured will be in the thousands.
Note (2): actual tests would be better for me than guess work.

Options: ReplyQuote

Written By
November 21, 2005 03:54PM
November 24, 2005 09:18AM
Re: count(*) versus mysql_num_rows
June 02, 2006 04:13AM
June 08, 2006 09:41AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.