If you read enough EXPLAIN ANALYZE output from PostgreSQL you start to get some ideas...
PostgreSQL makes estimates of queries before it dives into it. The same concept could be applied to Lemmy sorting orders and page numbers.
The whole project seem stuck on fringe cases. The reality is that the servers are running slow and overloading with routine fetches of Hot and Active post listings on page number 1, 2, or 3. Sure, some of the apps have speed scrolling to get to page 5 quickly... but there is too much concern out there for how page 970 behaves with a 5 month old posting... and the servers are crashing. Did I mention that the servers have been nonstop crashing since I came around in May?
Today I'm gong to experiment with doing what PostgreSQL does internally before picking an INDEX or a TABLE scan... some hints to the query where to go. For every sort order, there is a natural way to approach routine conventional paging... the trick is how to apply that to both single community and a blend of many communities.