MariaDB [test]> create or replace table t(i int primary key); Query OK, 0 rows affected (0.001 sec) MariaDB [test]> insert into t select seq from seq_1_to_10000000; Query OK, 10000000 rows affected (13.018 sec) Records: 10000000 Duplicates: 0 Warnings: 0 MariaDB [test]> MariaDB [test]> explain extended select count(*) from t ; +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ | 1 | SIMPLE | t | ALL | NULL | NULL | NULL | NULL | 9985950 | 100.00 | | +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ 1 row in set, 1 warning (0.000 sec) MariaDB [test]> select count(*) from t; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.756 sec) MariaDB [test]> select count(*) from t; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.754 sec) MariaDB [test]> select count(*) from t; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.754 sec) MariaDB [test]> MariaDB [test]> explain extended select count(*) from t force index (primary); +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ | 1 | SIMPLE | t | ALL | NULL | NULL | NULL | NULL | 9985950 | 100.00 | | +------+-------------+-------+------+---------------+------+---------+------+---------+----------+-------+ 1 row in set, 1 warning (0.000 sec) MariaDB [test]> select count(*) from t force index (primary) ; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.760 sec) MariaDB [test]> select count(*) from t force index (primary) ; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.758 sec) MariaDB [test]> select count(*) from t force index (primary) ; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.759 sec) MariaDB [test]> select count(*) from t force index (primary) ; +----------+ | count(*) | +----------+ | 10000000 | +----------+ 1 row in set (0.762 sec) MariaDB [test]> select version(); +----------------+ | version() | +----------------+ | 11.0.5-MariaDB | +----------------+ 1 row in set (0.000 sec) MariaDB [test]>