Why does MySQL InnoDB: set up a secondary index to speed up count ()?

with regard to count () optimization, it is better to build a smaller secondary index after MySQL version 5.7.18.

I know that clustered indexes are bloated than secondary indexes, but if you just count, you don"t have to scan the entire data row, just look at how many items in the index. Why can secondary indexes make count faster?

Mar.02,2021

didn't you say that the secondary index is smaller than the clustered index?
also scans the index, of course, the smaller the index, the faster.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5fc4e-45833.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5fc4e-45833.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?