Selecting With Large Offsets in SQL
Back to current version Restore this version

At times you want to do something like

sql> SELECT column FROM table WHERE condition LIMIT 100000,10

to offset the selection of ten items by 100k items. This will be very slow as it will fetch all the items and then discard the first 100k. The proper way to do it is

sql> SELECT column FROM table WHERE condition AND primary_key >= 100000 LIMIT 10


SQL