Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Offset vs page number when doing pagination

This is pretty trivial, but I noticed on SO that instead of an offset they are using page numbers. I know the difference is minor (multiply the page number by rows on a page or divide offset by rows on a page), but I'm wondering if one is recommended over the other.

Some sites, like Google, of course use a more complicated system because they need to track your actual search. But I'm thinking for a simple site where this doesn't matter.

What is the recommended technique?

like image 624
Darryl Hein Avatar asked Nov 22 '08 08:11

Darryl Hein


1 Answers

Use offsets. If you choose to allow variable (or user-defined) number of results per page, the coding is easy.

like image 199
Stefan Mai Avatar answered Oct 17 '22 04:10

Stefan Mai