欢迎光临
我们一直在努力

查询不存在最小ID,速度比较

#SELECT id FROM pp_user_id_auto_increment WHERE NOT EXISTS (SELECT 1 FROM pp_user WHERE pp_user.id=pp_user_id_auto_increment.id) AND `status`=0 LIMIT 0,1;        0.075s
#SELECT id FROM pp_user_id_auto_increment WHERE id NOT IN (SELECT id FROM pp_user) AND `status`=0 ORDER BY id ASC LIMIT 0,1;                                      0.2s
#SELECT MIN(id) FROM pp_user_id_auto_increment WHERE id NOT IN (SELECT id FROM pp_user) AND `status`=0 ORDER BY id ASC LIMIT 0,1;                                 40s

#SELECT MIN(id) FROM pp_user_id_auto_increment WHERE NOT EXISTS (SELECT 1 FROM pp_user WHERE pp_user.id=pp_user_id_auto_increment.id);                            200s

 

赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » 查询不存在最小ID,速度比较

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址