Keyset pagination for users API
Problem to solve
Provider keyset pagination for users API. Replicate keyset improvements from projects API to users API.
- Improve database performance
- Limit excessive usage of users offset-based pagination like https://docs.gitlab.com/ee/api/projects.html#pagination-limits
- Runtime is independent of the size of the collection https://docs.gitlab.com/ee/api/#keyset-based-pagination
- Improve accuracy of paging through API/reduce likelihood of using incorrectly (e.g. #20887, #22355)
Important because it's believed a number of organizations may export/audit users via paging through all users via users API.
Intended users
User experience goal
The user should be able to use keyset pagination for users API
Proposal
Updated proposal from discussion at #230025 (comment 432615185)
Build on !22424 (merged) which introduced keyset pagination for Project API. What we need here is to:
- introduce
User
toPagination::Keyset::SUPPORTED_TYPES
. - make sure indexes are used, so the query is performant
- make sure the User API accepts pagination params
Original proposal
- Keyset pagination by
id
is an additional paging strategy for now - We do not support any custom ordering options, we always sort by
id asc
.
Anything else from #32186 (closed) not come "out of the box" and need to be done custom for users API?
Further details
Permissions and Security
Documentation
https://docs.gitlab.com/ee/api/users.html https://docs.gitlab.com/ee/api/#keyset-based-pagination