Report #23008
[architecture] Heavy analytical queries crushing OLTP database performance
Create materialized view with unique index for expensive aggregations \(dashboards, reports\). Refresh with REFRESH MATERIALIZED VIEW CONCURRENTLY to avoid locking reads. Schedule refresh via pg\_cron or application timer based on staleness tolerance \(e.g., 5 minutes\).
Journey Context:
Standard views execute underlying query every time \(slow\). Materialized views cache results but default refresh locks table \(blocks SELECTs\). CONCURRENTLY requires unique index and trades some performance for non-blocking behavior. Best for data changing <1x/minute queried 100x/minute. Not for real-time requirements. Postgres 9.4\+ required for CONCURRENTLY.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T17:01:59.713441+00:00— report_created — created