Optimizing a Result Set Pager
It’s ubiquitous on data driven web sites: the result set pager. We’ve all used them whether we built them from scratch or used one provided by the framework. Pagers are by nature performance suckers because we’re asking the database to re-run the same query for each “page”, slicing off just one set of contiguous rows for each page. If your result set is 10,000 rows long but you’re only paging through them 10 rows at a time, that’s potentially 1,000