Skip to content

Consider storing more data in cursorΒ #6160

@Nutomic

Description

@Nutomic

At the moment our db cursors only store the prefix (type), item id and whether it is for previous or next page. With the item id we read the actual item (eg Post) from the database. Then we use fields like post.id, post.published_at etc from the loaded item to sort rows for pagination.

Instead it would be possible to get rid of this extra db read and store the relevant data (id, published_at, etc) directly inside the cursor. The easiest way would be to store the entire Post inside the cursor but this would make cursors too large. Instead the cursor should only contain which are used in .then_order_by() calls. The question is how to keep these two in sync when changes are made over time.

There is no breaking change required as the format of pagination cursors can change across minor versions. So this can be implemented anytime after 1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions