simonw / simonw/datasette

Ability to configure keyset pagination for views and queries

Open
#778 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

metadata performance
Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Description

Currently views offer pagination, but it uses offset/limit - e.g. https://latest.datasette.io/fixtures/paginated_view?_next=100

This means pagination will perform poorly on deeper pages.

If a view is based on a table that has a primary key it should be possible to configure efficient keyset pagination that works the same way that table pagination works.

This may be as simple as configuring a column that can be treated as a "primary key" for the purpose of pagination using metadata.json - or with a ?_view_pk=colname querystring argument.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing table pagination implementation and how metadata.json is handled for views and queries. Compare its behavior with the offset/limit pagination example in the issue, then determine how a configured primary-key column or _view_pk query argument should define keyset pagination. Done means view pagination supports efficient deeper-page navigation while preserving the existing table pagination behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.