Skip to content

Bound /v1/notifications initial load to last 90 days#761

Merged
dylanjeffers merged 1 commit intomainfrom
improve-notifications
Apr 10, 2026
Merged

Bound /v1/notifications initial load to last 90 days#761
dylanjeffers merged 1 commit intomainfrom
improve-notifications

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Heavy users saw /v1/notifications/:id p50 ~2.2s (max 8.9s) because the query had no upfront time bound on the initial load path — the planner had to materialize every notification matching user_ids, run per-row EXISTS checks and joins, then group/sort/limit at the very end.

On the initial load (timestamp_offset=0 AND group_id_offset='') bound n.timestamp to the last 90 days. Pagination (timestamp_offset > 0) stays unbounded so scrolling further back still works.

Heavy users saw /v1/notifications/:id p50 ~2.2s (max 8.9s) because the
query had no upfront time bound on the initial load path — the planner
had to materialize every notification matching user_ids, run per-row
EXISTS checks and joins, then group/sort/limit at the very end.

On the initial load (timestamp_offset=0 AND group_id_offset='') bound
n.timestamp to the last 90 days. Pagination (timestamp_offset > 0)
stays unbounded so scrolling further back still works.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dylanjeffers dylanjeffers requested a review from rickyrombo April 10, 2026 18:12
@dylanjeffers dylanjeffers merged commit 0247f66 into main Apr 10, 2026
5 checks passed
@dylanjeffers dylanjeffers deleted the improve-notifications branch April 10, 2026 19:35
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