服务器过滤了sql,我只好转为全角输入...


### mysql 证明为什么用limit时,offset很大会影响性能


* 基本信息
id为自增主键,val为非唯一索引。
灌入大量数据,共500万:
mysql> select count(*) from test;
1 row in set (4.25 sec)

* 常规sql
mysql> select * from test where val=4 limit 300000,5;
5 rows in set (15.98 sec)

* 优化sql
mysql> select * from test a inner join (select id from test where val=4 limit 300000,5) b on a.id=b.id;
5 rows in set (0.38 sec)