The other day I found the FOUND_ROWS()
(here) function in MySQL and it's corresponding SQL_CALC_FOUND_ROWS
option. The later looks especially useful (instead of running a second query to get the row count).
I'm wondering what speed impact there is by adding SQL_CALC_FOUND_ROWS
to a query?
I'm guessing it will be much faster than runnning a second query to count the rows, but will it be a lot different. Also, I have found limiting a query to make it much faster (for example when you get the first 10 rows of 1000). Will adding SQL_CALC_FOUND_ROWS
to a query with a small limit cause the query to run much slower?
I know I can test this, but I'm wondering about general practices here.