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.

Menu