Recipient unsent messages#73
Merged
Merged
Conversation
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaced a single, slow query for paginated recipients with unsent message counts with a split-query approach. This eliminates global aggregates and planner-hostile SQL by fetching recipients first, then querying unsent message counts for only those recipients, and merging results in application code. New composite
recipient_by_userand partialmessage_unsent_by_recipientindexes support this optimized approach, avoiding full table scans and temporary group-by operations.Test Plan
recipient-query-plans.logto confirm:SCAN Messagein Query A or B.USE TEMP B-TREE FOR GROUP BY.message_unsent_by_recipientindex.recipient-query-timings.logfor performance improvements compared to the legacy query.prisma/migrations/20260202160000-recipient-message-indexes/migration.sqlis applied, creating the necessary indexes.Checklist
Screenshots
Recipients list shows prepared message counts.
Note
Medium Risk
Touches core recipient list data-loading and introduces new SQL + indexes; risk is mainly incorrect counts or query regressions if the typed SQL/index usage behaves differently across environments.
Overview
Improves recipients list performance by removing Prisma
_countaggregation for unsent messages and instead fetching recipients first, then querying unsent message counts for just those recipient IDs via new typed SQLgetunsentmessagecountsand merging results intomessageCount.Adds SQLite indexes (
recipient_by_usercomposite and a partialmessage_unsent_by_recipienton unsent messages) and updates the benchmark script to measure the new split-query approach with configurable recipient page sizing.Written by Cursor Bugbot for commit f228e88. This will update automatically on new commits. Configure here.