It is common that we used to count the number of records in a table. You may encounter unexpected performance degradation in certain situations.
Here is an example SQL that count number of records from EMPLOYEE table. There are number of indexes are built such as emp_id, emp_dept, emp_grade, emp_hire_date and etc....
SELECT COUNT(*)
FROM EMPLOYEE;
You can see MySQL SQL Optimizer use a Full Index Scan of...
How to Tune SQL with COUNT(*) statements ?
Here is an example SQL that count number of records from EMPLOYEE table. There are number of indexes are built such as emp_id, emp_dept, emp_grade, emp_hire_date and etc....
SELECT COUNT(*)
FROM EMPLOYEE;
![[IMG]](http://live.staticflickr.com/65535/50314289188_5d18f63a2e_b.jpg)
You can see MySQL SQL Optimizer use a Full Index Scan of...
How to Tune SQL with COUNT(*) statements ?