advancedTop 15 Database Design Questions

Design a database for distributed message queue / event store.

events(id UUID PK, stream_id VARCHAR, event_type VARCHAR, payload JSONB, created_at TIMESTAMPTZ DEFAULT NOW(), global_seq BIGSERIAL UNIQUE) stream_checkpoints(stream_id VARCHAR PK, consumer_group VARCHAR, last_global_seq BIGINT) -- track consumer position dead_letter_queue(id UUID, original_event_id UUID FK, error_message TEXT, retry_count INT, last_retried_at TIMESTAMPTZ) Partitioning: events by

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What's the fundamental difference between a simple view and a materialized view?← Back to all SQL questions