现状: 分页查询sql中使用了distinct去重,并使用order by create_date,以及limit
使用distinct:产生了临时表
优化思路: 去掉distinct ,使用group by 替代,依然使用了临时表
由于主键本身就确保了唯一,那么创建时间和id的联合唯一索引,这样就可以避免使用临时表在内存中排序, UNIQUE KEY idx_create_date_id
(create_date
,id
) USING BTREE
避免产生了临时索引