3 ms·
One great approach is cursors. Basically, you keep track of the value of the sort function (e.g., relevance) of the last record on the page, and add that to you
by tantalor 11y ago
One great approach is cursors. Basically, you keep track of the value of the sort function (e.g., relevance) of the last record on the page, and add that to your filter (e.g., WHERE relevance > $LAST_RELEVANCE) to get the next page.
This is very efficient when your table is indexed by that field; you can seek directly to the next record.
Some database APIs do this for you!
I wrote up my experience implementing this on App Engine here,
http://johntantalo.com/blog/paginating-with-bookmarks-in-app-engine/ http://johntantalo.com/blog/paginating-with-bookmarks-in-app...