Write a SQL query to analyze operational performance by vendor at Scale, including throughput, average turnaround time, and error rate over time. Use the provided vendor and job data. Treat completed and error jobs as processed, calculate turnaround time for completed jobs, and exclude in-progress jobs from throughput and error-rate calculations.
Output
- One row per vendor and month with processed jobs.
- Columns:
vendor_name, period_month, throughput, average_turnaround_minutes, and error_rate_pct.
- Sort by
vendor_name, then period_month ascending.
Output details
- Restrict jobs to
completed_at >= TIMESTAMP '2025-01-01 00:00:00' and < TIMESTAMP '2025-04-01 00:00:00'.
- Derive
period_month as the first day of the month containing completed_at.
- Include vendor-month rows with zero processed jobs, returning
NULL for average_turnaround_minutes and error_rate_pct.
- Round
average_turnaround_minutes and error_rate_pct to two decimal places.
- Exclude completed jobs missing
started_at or completed_at from the turnaround average.