Article about bug report #68814 related to testing count(*) explain plan.
Or sales table huge enough to play with.
mysql> select count(*) from sales; +----------+ | count(*) | +----------+ | 2500003 | +----------+ 1 row in set (0.56 sec)
First with regular count(*) without where clause:
mysql> explain select count(*) from sales\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: sales
         type: index
possible_keys: NULL
          key: sales_cust_idx
      key_len: 4
          ref: NULL
         rows: 2489938
        Extra: Using index
1 row in set (0.00 sec)
Estimated rows -> rows: 2489938
Then with {where sales_id > 0}:
mysql> explain select count(*) from sales where sales_id > 0\G *************************** 1. row …[Read more]