[thelist] MySQL Total number of results with LIMIT set

Maximillian Schwanekamp lists at neptunewebworks.com
Thu May 26 13:26:27 CDT 2005


Phil Turmel wrote:
> Actually, since MySQL 4.0, you can check FOUND_ROWS() after a query to 
> determine how many would have been returned if no LIMIT was specified.

You can also use MySQL's query cache[0] to your advantage - you actually 
could do the whole query each time, and use array_slice() to get the 
part you want for the results page.  If you have MySQL configured for 
caching, it will just pull the results from cache rather than 
re-processing the query.

[0] http://www.databasejournal.com/features/mysql/article.php/3110171

-- 
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/



More information about the thelist mailing list