我有2990萬點的記錄表,抵消消耗太多的查詢執行時間MySQL的InnoDB的選擇刀慢
SELECT * FROM table_records LIMIT 50 OFFSET 1999950
this query taking 33.087 sec
我已經改變了偏移量200萬
SELECT * FROM table_records LIMIT 50 OFFSET 2000000
this query taking 2.030 sec
交代
EXPLAIN SELECT * FROM table_records LIMIT 50 OFFSET 29941250
id | select_type | table | type | possible_keys | key | key_len | ref |rows | Extra
1 | SIMPLE | table_records | index | (NULL) | PRIMARY | 4 | (NULL) |29900771 |
我已經刪除偏移量只是設置爲限制
SELECT * FROM table_records LIMIT 50
this query taking 0.002 sec
任何建議或想法讚賞。
查詢的偏移越慢。相關[**帖子**](http://stackoverflow.com/questions/4481388/why-does-mysql-higher-limit-offset-slow-the-query-down) – 1000111
儘量避免使用偏移量 – Mike
是這個錯誤還是限制,我用它來列表頁面的分頁。 :(任何其他解決方案? – user3151197