guyeuro
V2EX  ›  问与答

mysql 的 limit 优化

  •  
  •   guyeuro · Sep 11, 2017 · 2424 views
    This topic created in 3363 days ago, the information mentioned may be changed or developed.

    下面两个语句

    select phone from user  where id >(select id from user limit 3000000,1) order by id limit 0,10;
    
    select phone from user  order by id limit 3000001,10;
    

    测试多次,第一个总是比第二个好, 索引都是主键 id 为何会有区别?

    1 replies  •  2017-09-11 23:48:02 +08:00
    guyeuro
    guyeuro
    OP
    Sep 11, 2017
    1
    顶顶顶!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3598 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 01:02 · PVG 09:02 · LAX 17:02 · JFK 20:02
    ♥ Do have faith in what you're doing.