Skip to content

Docs feedback: Improve Keyset Pagination Query Example

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

SQL example in section

The SQL example in the GitLab pagination guidelines documentation can be optimized for readability and performance.

Proposal

Since PostgreSQL supports row constructor comparisons, we can use this feature to simplify and optimize the query:

SELECT "issues".*
FROM "issues"
WHERE (created_at, id) > ('2021-02-16 11:26:17.408466', 99)
   OR created_at IS NULL
ORDER BY "issues"."created_at" DESC NULLS LAST, "issues"."id" DESC
LIMIT 20
Edited by 🤖 GitLab Bot 🤖