Add offset-based pagination to list personal/group/project/impersonation tokens
# Background The list of personal/group/project/impersonation tokens can be very large. For example in production the user `gitlab-qa` (1614863) has 69366: ``` select count(id) FROM "personal_access_tokens" WHERE user_id = 1614863; count ------- 69366 (1 row) ``` According to [this Sentry report](https://sentry.gitlab.net/gitlab/gitlabcom/issues/3313240/?query=user%3A%22username%3Agitlab-qa%22) the following query can take longer than 15000ms and cause a timeout: ``` SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."user_id" = 1614863 AND "personal_access_tokens"."impersonation" = FALSE AND (revoked = false AND (expires_at >= CURRENT_DATE OR expires_at IS NULL)) ORDER BY "personal_access_tokens"."expires_at" ASC; Time: 1067.024 ms (00:01.067) ``` I suggest we change that above query for a offset-based query: ``` SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."user_id" = 1614863 AND "personal_access_tokens"."impersonation" = FALSE AND (revoked = false AND (expires_at >= CURRENT_DATE OR expires_at IS NULL)) ORDER BY "personal_access_tokens"."expires_at" ASC LIMIT 100 OFFSET 0; Time: 766.373 ms ``` The gitlab~3412464 work to [support pagination has been partially completed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89131). Related to [this incident](https://gitlab.com/gitlab-com/gl-infra/production/-/issues/7163) and this [QA cleanup task](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1339). # Steps - [x] [Add backend pagination support for personal access tokens](https://gitlab.com/gitlab-org/gitlab/-/issues/367837) - [ ] [Add pagination support in the frontend](https://gitlab.com/gitlab-org/gitlab/-/issues/367840) - [ ] [Add backend pagination support for group/project tokens](https://gitlab.com/gitlab-org/gitlab/-/issues/367843) - [ ] [Add backend pagination support for impersonation tokens](https://gitlab.com/gitlab-org/gitlab/-/issues/367842)
epic