Skip to main content

purge_dlq

SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.

Signature​

postgremq.purge_dlq()
RETURNS void

The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.

Discard all dead-letter entries​

Deletes the entire DLQ across every queue. It does not accept a queue selector. Payloads remain until no references exist and retention collects them. Removing dead letters can permit an expired queue to be reaped.

Transactions and errors​

Destructive global scope. Transactional, unbatched, and can lock many rows. Inspect all entries first; it does not replay or undo effects.

All calls require the applicable caller privileges. See SQL errors for driver failures and uncertain outcomes.

Example​

Run only in an isolated scratch database: this example targets every queue and takes real locks even though it rolls back. Use psql with ON_ERROR_STOP.

BEGIN;
-- Isolated scratch database only: this targets every queue.
SELECT * FROM postgremq.list_dlq_messages();
SELECT postgremq.purge_dlq();
SELECT * FROM postgremq.list_dlq_messages();
ROLLBACK;

The DLQ is empty inside the transaction. Rollback retains preexisting entries, but the operation still takes real locks.

Related: Dead letters, SQL conventions.