This article starts with the problems encountered and analyzes the TDDL optimizer, the MySQL index, and the selection of shard keys for table partitioning.