no-analytical-aggregation-in-postgres-store
Potentially analytical PostgreSQL store queries require review.
Why
Unbounded reporting and statistical scans can compete with transactional reads. Transactional invariants, queue coordination, bounded hydration, and other strongly consistent operational aggregates remain valid PostgreSQL work.
Fix
Review the query bounds and execution plan. Move reporting scans to the repository's columnar store, or document why the aggregate must remain transactional.
Examples
import psycopg
QUERY = "SELECT DATE_TRUNC('day', occurred_at), COUNT(*), AVG(latency_ms) FROM event GROUP BY 1"import psycopg
QUERY = "SELECT SUM(amount) FROM ledger WHERE account_id = %s FOR UPDATE"Formerly: no-aggregation-in-store-query