CREATE TABLE IF NOT EXISTS live_session_outbox ( id BIGSERIAL PRIMARY KEY, streamer_uid BIGINT NOT NULL, event_ts_ms BIGINT NOT NULL, payload BYTEA NOT NULL, retry_count INTEGER NOT NULL DEFAULT 0, next_retry_at_ms BIGINT NOT NULL ); CREATE INDEX IF NOT EXISTS live_session_outbox_due_idx ON live_session_outbox(next_retry_at_ms, id);