Hot partition index bloat
Your task
You store metrics/events in a Postgres table partitioned by day (range partitioning on event_time). Ingestion is steady but the current day's partition is the write hot spot, and over the past week, write latency on inserts has been creeping up and now spikes badly near peak, even though older partitions are idle. Index bloat on the active partition's indexes looks high, and pg_stat_user_tables shows almost all updates/HOT-update misses concentrated there. Autovacuum mostly leaves the hot partition alone during the day. Triage and mitigate.
It covers
- Time series
- Partition pruning
- Recent partition