复制#创建表 CREATETABLE `test` ( `id` int(11) NOTNULL,索引 `a` int(11) NOTNULLdefault 0, `b` int(11) NOTNULLdefault 0, PRIMARYKEY (`id`), KEY `a` (`a`), KEY `b` (`b`) ) ENGINE=InnoDB; #添加数据 delimiter ;; createprocedure xddata() begin declare i int; set i=1; while(i<=100000)do insertinto test values(i, i, i); set i=i+1; end while; end;; delimiter ; call xddata(); 数据查询 explain select * from test where (a between 1000 and 2000) and (b between 50000 and 100000) orderby b limit 1; 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.