Roundup Tracker - Issues

Message8141

Author rouilj
Recipients rouilj
Date 2024-10-20.22:20:47
Message-id <1729462848.17.0.51657404308.issue2551364@roundup.psfhosted.org>
In-reply-to
https://dev.to/scion01/optimizing-pagination-in-postgresql-offsetlimit-vs-keyset-21dp

Discusses changing pagination to use keyset vs offset/limit (aka page number/page size).

The idea is to replace:

  SELECT * FROM table ORDER BY id ASC LIMIT 100 OFFSET 100;

with:

  SELECT * from table where id > x ORDER BY id ASC LIMIT 100

where X was the max id in the prior set of 100 items.

For larger offsets, the database has to retrieve and order all rows up to OFFSET
and then discard them. In the second case, the index prevents retrieving
rows that would be in the OFFSET region. Only rows with an id larger than X
would be processed. This may come in play only for large offsets (high page number)
but is worth investigating as it could improve response times for X.index.html pages.
History
Date User Action Args
2024-10-20 22:20:48rouiljsetrecipients: + rouilj
2024-10-20 22:20:48rouiljsetmessageid: <1729462848.17.0.51657404308.issue2551364@roundup.psfhosted.org>
2024-10-20 22:20:48rouiljlinkissue2551364 messages
2024-10-20 22:20:47rouiljcreate