Random Link ¯\_(ツ)_/¯ | ||
Jan 3, 2021 | » | Information Retrieval Medley
3 min; updated Sep 5, 2022
Pagination with Relative Cursors Exposing pagination through URLs like example.com/items?page=25&limit=100 leads to SQL like SELECT * from 'items' LIMIT 100 OFFSET 2400;, which inefficiently goes through 2,500 records and discards the first 2,400. With relative cursors, we have URLs like example.com/items?limit=50&lastID=XXX, which leads to SQL like SELECT * from 'items' WHERE 'id' > XXX ORDER BY 'id' ASC LIMIT 50, and this is more efficient, assuming there are indexes for id.... |