SELECT count(1) as count FROM table WHERE update_time >= '1628651608' AND update_time <= '1629256408' AND `online` = '1';
这段MYSQL查询要38s,该怎么优化呢?
添加online和update_time 联合索引
性能对比结论
count(可空字段) < count(非空字段) = count(主键 id) < count(1) ≈ count(*)
SELECT count(1) as count FROM table WHERE update_time >= '1628651608' AND update_time <= '1629256408' AND `online` = '1';
这段MYSQL查询要38s,该怎么优化呢?
添加online和update_time 联合索引
性能对比结论
count(可空字段) < count(非空字段) = count(主键 id) < count(1) ≈ count(*)
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M