In Mysql, I have a table (employee_by_range). I am getting rows using count
and explain
when am i trying to get rows using COUNT()
, it's return 15880256 rows
mysql> select count(1) from test.employee_by_range;
+----------+
| count(1) |
+----------+
| 15880256 |
+----------+
1 row in set (4.80 sec)
when am i trying to get rows using EXPLAIN
it's return 27912636 rows
mysql> explain select emp_id from test.employee_by_range;
+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+
| 1 | SIMPLE | employee_by_range | ALL | NULL | NULL | NULL | NULL | 27912636 | NULL |
+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+
1 row in set (0.00 sec)
Why both row's count are different ?