A benchmark-driven exploration of using PostgreSQL as a replacement for Redis (caching), RabbitMQ (job queues), Elasticsearch (full-text search), and pub/sub systems. Two identical PostgreSQL 17 instances are compared — one using naive patterns, one using optimized built-in features like UNLOGGED tables, SKIP LOCKED, tsvector with GIN indexes, and LISTEN/NOTIFY. Key findings: tsvector+GIN delivers a 10x p95 improvement over ILIKE searches; SKIP LOCKED is production-ready for job queues; UNLOGGED tables give a consistent 13% write speedup; LISTEN/NOTIFY reduces pub/sub latency by 20% at p95. Under combined workload, the optimized setup adds ~15% overhead but stays under 10ms p95. The conclusion is that a well-configured PostgreSQL instance can replace 3-5 specialized services for most web applications, with clear guidance on where dedicated tools are still warranted.
Table of contents
Table of ContentsPrerequisitesThe SetupBenchmark 1: Caching with UNLOGGED TablesBenchmark 2: Job Queues with SKIP LOCKEDBenchmark 3: Full-Text Search with tsvectorBenchmark 4: Pub/Sub with LISTEN/NOTIFYThe Combined Workload: The Honest TestWhat I Learned1 Comment
Sort: