Skip to content

Bound cursor pagination by the timestamp - #4469

Merged
r4victor merged 1 commit into
masterfrom
issue_4465_cursor_range_bound
Nov 5, 2026
Merged

r4victor merged 1 commit into
masterfrom
issue_4465_cursor_range_bound

Conversation

@r4victor

@r4victor r4victor commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

On dstack Sky, /api/events/list with a cursor takes ~3 s because Postgres can't start an index scan at the cursor from the cursor's OR filter and reads from the oldest event instead (#4465).

  • Add a redundant timestamp bound next to the cursor OR in the events, runs, users, projects, fleets, instances, and volumes lists, so the ordered scan starts at the cursor; with 1M events locally under generic plans, a caught-up events poll drops from ~50 ms to ~18 ms and a runs page 15 days back from ~120 ms to ~36 ms.
  • Document the cursor pagination approach in contributing/DATABASE.md.
  • Add a test that pages through events with the same recorded_at.

@r4victor
r4victor merged commit ae36f0a into master Nov 5, 2026
26 checks passed
@r4victor
r4victor deleted the issue_4465_cursor_range_bound branch November 5, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant