Skip to main content

What is AWR?

AWR stands for Automatic Workload Repository — a feature introduced in Oracle Database that periodically captures a snapshot of key performance statistics and stores them in a repository. By comparing two snapshots, DBAs can generate detailed workload reports that reveal exactly how the database behaved during a specific period.

PMP4PG implements an equivalent mechanism for PostgreSQL, bringing the same proactive analysis methodology to the open-source world.


The Core Concept

While ASH gives you a real-time, sample-based view of session activity, AWR operates at a different timescale. Instead of looking at individual sessions second by second, AWR answers questions like:

  • How did my database perform between 9 AM and 11 AM compared to yesterday?
  • Which queries consumed the most total CPU time during last night's batch?
  • Did my cache hit ratio degrade after the schema change I deployed on Friday?
  • How much WAL did we generate during peak hours this week?

How PMP4PG Implements AWR

Every 30 minutes, the PMP4PG backend automatically creates a numbered snapshot — a point-in-time aggregation of all key PostgreSQL statistics accumulated since the previous snapshot.

Snapshot N (09:00) Snapshot N+1 (09:30)
│ │
│←────── 30 minutes ────────→│
│ │
└──────── AWR Report ────────┘
(delta between N and N+1)

Each snapshot records:

Data SourceWhat Is Captured
pg_stat_statementsQuery-level execution statistics (cumulative counters)
pg_stat_databaseDatabase-level throughput statistics
pg_stat_bgwriterBackground writer and checkpoint statistics
pg_stat_walWAL generation statistics
pg_stat_user_tablesTable-level access and vacuum statistics
pg_stat_user_indexesIndex-level usage statistics
pg_locksLock contention data
pg_database_size()Database sizes
OS metricsCPU, memory, disk at snapshot time

Snapshots vs. Live Data

Live Data (ASH)AWR Snapshots
Granularity2-second samples30-minute aggregates
RetentionHours (purged regularly)Long-term (configurable)
Use caseReal-time incident diagnosisProactive analysis, trends
Report typeASH ReportAWR Report

Relationship to Oracle AWR

Oracle ConceptPMP4PG Equivalent
AWR SnapshotPMP4PG AWR Snapshot (every 30 min)
DBA_HIST_* tables*_history tables in PMP repository
DBMS_WORKLOAD_REPOSITORYPMP4PG AWR Snapshot Engine (backend)
AWR Report (awrrpt.sql)PMP4PG AWR Viewer + HTML Export
Snapshot IDPMP4PG Snapshot number
BaselinePlanned for a future release

Next Steps