A LIMIT clause can be used in a SELECT query to limit the number of rows the server returns to the client. In some circumstances, it would be useful to know how many rows the statement would have returned if the LIMIT clause had not been present but without rerunning the statement. Include the SQL_CALC_FOUND_ROWS option in the SELECT statement and then call FOUND_ROWS() to get the row count.
Example:
SELECT SQL_CALC_FOUND_ROWS * FROM tbEmployee WHERE id >= 1 LIMIT 10;
SELECT FOUND_ROWS();
The table tbEmployee in the example has 64 rows. The first query returns 10 rows as a result of the LIMIT clause. The second query returns the remaining 54 entries in the table because it invoked the FOUND_ROWS() function.
However, The SQL_CALC_FOUND_ROWS query modifier and accompanying FOUND_ROWS() function are deprecated as of MySQL 8.0.17; expect them to be removed in a future version of MySQL. As alternative use the following:
SELECT * FROM tbEmployee WHERE id >= 1 LIMIT 10;
SELECT COUNT(*) FROM tbEmployee WHERE id > 10;
Performance-wise, the latter retrieves the result-set more quickly and effectively. However, the indexes on the columns continue to be important.