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?