mysql slow sql之index跟range之间的差异

mysql slow sql之index和range之间的差异

今天发现线上一条SQL结果出不来,explain看了一下发现走的index不对。性能瓶颈出在order上,通过对比order by id ,order by add_datetime发现index的性能会比range的性能差,参考截图:

?之后use index(idx_add_t)虽然rows多了,但type是range,实际性能比第一条sql好。

mysql slow sql之index跟range之间的差异

相关文章:

你感兴趣的文章:

标签云: