> That would give the correct result, but it would still physically count all > the rows in the table which takes too long. This code will execute every > time a web page opens that has a grid. Some of the grid pages are quite > large, > 1 million rows. The person who designed the web page originally > didn't think that would matter much. I keep telling him you can't count 1 > million rows every time a web page opens. The site would probably support > around 5 people.<g> > > I will go with the "mysql_num_rows" which shouldn't add any additional CPU > or I/O. It seems like a perfect solution once I move some code around. Thanks. > > Mike
MySQL's COUNT(*) function is optimized to quickly return the total number of rows in a table. Check the first definition on this page: http://www.mysql.com/doc/G/r/Group_by_functions.html Using a different SELECT statement and calling mysql_num_rows will return the entire result set, which is what you are trying to avoid. So, if you want to support more than 5 people on your site, use COUNT(*). --jeff --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php