You are given transaction, partner, and gateway event data for an Instacart partner. Write a PostgreSQL query that helps you investigate a spike in failed transactions by returning the daily failed-transaction rate for each partner, the prior-day rate, and the day-over-day change for the partner with the largest spike in the last 14 days.
Use the partner’s transaction status and the latest gateway event per transaction to determine whether a transaction failed. Focus on completed attempts only, and exclude test transactions. The result should make it easy to spot when the spike started and how severe it was relative to the previous day.