Conference India 2026 • Nov 25, 2026 • Session details

Lessons learned after 6.7T events through PostgreSQL queues

Mihir Gandhi

You might not need Apache Kafka for massive event streams. See how RudderStack processed 6.7 trillion events using a PostgreSQL queue by favoring table drops over deletes.

Pause
Mute Enter Fullscreen
#1 about 4 min

Processing customer behavioral events in order at scale

Routing behavioral events across hundreds of destinations requires supporting thousands of parallel, independent, and retryable streams that guarantee per-user event ordering.

#2 about 2 min

Why PostgreSQL was chosen over Apache Kafka for queuing

Supporting thousands of isolated streams in Kafka introduces either massive topic overhead or head-of-line blocking, whereas PostgreSQL enables isolated streams and simple CRUD debugging.

#3 about 5 min

Database queue design using append-only tables and datasets

To avoid the performance overhead of dead tuples from PostgreSQL update and delete operations, the system uses append-only status tables and drops entire dataset tables after processing.

#4 about 3 min

System architecture and multi-node Kubernetes deployment strategy

Traffic is segregated into namespaces and distributed across self-contained nodes—each running dedicated gateway, processor, and PostgreSQL containers—using consistent hashing on user IDs.

#5 about 3 min

Optimizing query latency with composite indexes and recursive CTEs

Replacing sequential index scans on duplicate connection entries with composite indexes for index-only scans and recursive CTEs for loose index scans reduced query latency from 150ms to 1ms.

#6 about 3 min

Mitigating retry storms and minimizing lock times during compaction

Downstream outages cause table bloat from repeated failed status inserts, requiring targeted deletions of old statuses and lock-free background table compaction to prevent processing pauses.

#7 about 3 min

Reducing insertion, query, and network amplification overheads

Switching to bulk COPY insertions, adding application-level caching to skip empty datasets, and storing payloads as plain text instead of hex-encoded byte arrays drastically reduced system and network load.

#8 about 4 min

Managing storage amplification and tuning PostgreSQL configuration parameters

Accounting for 3x disk write amplification from WAL, TOAST, and indexes must be paired with tuning autovacuum naptime, random page cost for SSDs, and checkpoint timeouts for fast crash recovery.

#9 about 3 min

Core engineering takeaways for building high-throughput database queues

Scaling PostgreSQL to 100,000 events per second succeeded by questioning conventional broker wisdom, designing around database constraints, continuously measuring query bottlenecks, and iterating in production.

#10 about 3 min

Guaranteeing message ordering and evaluating loose index scan performance

Event ordering is preserved by processing datasets chronologically per user ID, while recursive CTE loose index scans outperform DISTINCT queries specifically because active connections per dataset remain low.

Matching moments

4:30 min

Introducing data management and the shift to streaming

Mary Grygleski Mary Grygleski · LIVE

4:14 min

Recognizing architectural drivers pushing event streaming system adoption

Mary Grygleski Mary Grygleski · LIVE

6:56 min

Demonstrating event-driven auto-scaling with native Quarkus and Kafka

Daniel Oh Daniel Oh +1 · World Congress 2024

2:18 min

Comparing PostgreSQL and DynamoDB for read-heavy storage

George Asafev · World Congress 2023

54 sec

Scaling database infrastructure for massive retail events

Florian Mair Florian Mair · World Congress 2024

2:00 min

Moving from traditional databases to decoupled event streaming

Gerard Klijs · LIVE