This document discusses using PostgreSQL and Redis together for a high performance ad serving system. Redis is used as a fast in-memory database to store frequently accessed data like ad impressions and clicks. A Redis foreign data wrapper allows PostgreSQL to efficiently retrieve this data from Redis and load it into the recording database. The PostgreSQL databases store longer term data and handle reporting. Materialized views are used to optimize ad filtering queries. Together PostgreSQL and Redis allow the system to serve over 10,000 ads per second while recording analytics data for reporting.