3 ms·
Yes it can - if you do it right. When you do paging, you need to count n·50 or whatever items LIMIT <page_size> OFFSET <page-number>*<page_size With reasona
by labawi 6y ago
Yes it can - if you do it right. When you do paging, you need to count n·50 or whatever items
LIMIT <page_size> OFFSET <page-number>*<page_size
With reasonable indexes, the OFFSET is the killer. When doing infinite scroll (or variable-size paging by predetermined items), you can ask for the next batch with a greater-than filter:
SELECT ... where data > last_item ..
LIMIT 50; -- no OFFSET
Note that you should probably use query-by-data even if performance is not a concern, as row addition/removal create artifacts in infinite scroll.
That being said, from user POV, I usually don't like infinite scroll - it can be time consuming, as you usually can't binary / guesstimate search the result set.