Skip to content

perf: keep notification relevance checks as lookups instead of hashes - #1225

Merged
mnapoli merged 1 commit into
productionfrom
perf/notification-exists-lookup
Oct 27, 2026
Merged

mnapoli merged 1 commit into
productionfrom
perf/notification-exists-lookup

Conversation

@mnapoli

@mnapoli mnapoli commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

In NotificationBuilder::relevant(), the EXISTS checks joined by OR get planned as hashes over the whole follows/commits tables. An OFFSET 0 keeps each one a per-notification index lookup. This query feeds the unread count, which every open tab polls every 30s.

Query (prod copy) Before After
Oldest unread, user with 12k notifications (30s poll) 33 ms 0.2 ms
Notification groups, 2k notifications 64 ms 25 ms
Notification groups, 12k notifications 163 ms 135 ms

Same rows returned.

Summary by CodeRabbit

  • Improvements
    • Notification processing now handles follow-up and commit-related records more consistently. Existing notification types, statuses, and matching conditions remain unchanged, so the notifications users receive continue to follow the same criteria. No new notification types or user-facing controls were added.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7144f806-a8ac-4467-8b64-4f0ac78e8237
Commits

Reviewing files that changed from the base of the PR and between f4d417a and 4780ac5.

Files selected for processing: 1
  • app/Queries/NotificationBuilder.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

NotificationBuilder::relevant() adds offset(0) to the follow lookup and both commit relationship queries. The matching conditions remain unchanged. A comment describes the intended query-planning effect.

Changes: Notification relevance

Layer / File(s) Summary
Relevance lookup planning
app/Queries/NotificationBuilder.php
The follow lookup and both commit relationship queries add offset(0). Their matching conditions remain unchanged. A comment describes the intended query-planning effect.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Suggested reviewers: hbenabdallah, xheaven, nunomaduro

Merge Risk: Minimal · up to 4780a

No actionable merge-blocking risk is established for the documented PostgreSQL deployment.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main performance change: keeping notification relevance checks as lookups instead of hash-based plans.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mnapoli
mnapoli merged commit 028ec16 into production Oct 27, 2026
10 checks passed
@mnapoli
mnapoli deleted the perf/notification-exists-lookup branch October 27, 2026 12:31
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