A248 / LibertyBans

The be-all, end-all of discipline.
https://ci.hahota.net:8443/job/LibertyBans/
GNU Affero General Public License v3.0
169 stars 41 forks source link

[Feature Request]: Keyset pagination for list commands #191

Open A248 opened 1 year ago

A248 commented 1 year ago

I have confirmed that ...

Description

The use of fixed pages reduces database efficiency because the RDMS must scan all punishments up to and including those on the specified page, before discarding the previous pages. For example, /banlist 10 requires the database to internally retrieve pages 1-9 only to discard them after the SQL LIMIT clause is applied.

Keyset pagination was one of the original motives behind offering seekAfter in the API. For compatibility reasons, the list commands continue to use OFFSET / LIMIT instead of keyset pagination. We should offer an option to toggle keyset pagination, which would change the applicable variables. This feature would be best paired with clickable messages. It's worth considering what to do if a user nevertheless enters a fixed page number. Perhaps keyset pagination and traditional fixed-page specification could work alongside each other for maximum utility, combining convenience and efficiency.