AccountsController#show renders the paginated activity feed with several N+1 query clusters that Sentry has flagged across 60–150 unique users:
- SURE-APP-PN / SURE-APP-XE / SURE-APP-26 —
transfer_as_inflow / transfer_as_outflow (and category) loaded per transaction row of the page (≈40 rows × multiple queries).
- SURE-APP-X3 / SURE-APP-X6 — slow-DB reports on the same action.
- A
split_parent? N+1 — entry.split_parent? calls child_entries.exists? per entry because the view's @split_parent_entry_ids guard is never set by this action. TransactionsController#index already sets it; AccountsController#show is the only caller that doesn't.
Scope: in AccountsController#show, after pagination, preload the page transactions' transfer_as_inflow/transfer_as_outflow/category/merchant associations and set @split_parent_entry_ids via a single batch pluck over the page's entry IDs — eliminating the per-row queries. Page-scoped by design (only the rendered page resolves its split parents).
AccountsController#showrenders the paginated activity feed with several N+1 query clusters that Sentry has flagged across 60–150 unique users:transfer_as_inflow/transfer_as_outflow(andcategory) loaded per transaction row of the page (≈40 rows × multiple queries).split_parent?N+1 —entry.split_parent?callschild_entries.exists?per entry because the view's@split_parent_entry_idsguard is never set by this action.TransactionsController#indexalready sets it;AccountsController#showis the only caller that doesn't.Scope: in
AccountsController#show, after pagination, preload the page transactions'transfer_as_inflow/transfer_as_outflow/category/merchantassociations and set@split_parent_entry_idsvia a single batch pluck over the page's entry IDs — eliminating the per-row queries. Page-scoped by design (only the rendered page resolves its split parents).