Why are failures high during peak hours?
Based on the analysis, transaction failures are significantly higher during peak hours (8-9 PM) due to network timeouts. 4G connections show a 23% higher timeout rate compared to 5G and WiFi.
SELECT
HOUR(timestamp) as hour,
network_type,
COUNT(*) as total_transactions,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failures,
ROUND(100.0 * SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) / COUNT(*), 2) as failure_rate
FROM transactions
WHERE timestamp >= DATE_SUB(NOW(), INTERVAL 7 DAY)
GROUP BY HOUR(timestamp), network_type
HAVING failure_rate > 10
ORDER BY hour, failure_rate DESC;