queue_metrics
SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.
Signature
postgremq.queue_metrics()
RETURNS TABLE(queue_name text, topic_name text, active bigint, ready bigint, delayed bigint, processing bigint, exhausted bigint, dead_letter bigint, oldest_ready_age_seconds double precision)
The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.
Read operational queue state
Returns one row per queue including empty and expired Exclusive queues. Ready includes visible unsettled rows below the attempt limit, including blocked FIFO successors. For an expired Exclusive queue, active, ready, and oldest_ready_age_seconds are forced to zero; delayed, processing, exhausted, and dead_letter still reflect retained rows. Processing counts live leases, not active handlers. The metrics reference defines every column and unit.
Transactions and errors
Read-only STABLE function evaluated with one statement timestamp, under caller privileges. Reads no payloads. Cost grows with backlog and DLQ; retain a query deadline.
All calls require the applicable caller privileges. See SQL errors for driver failures and uncertain outcomes.
Example
SELECT * FROM postgremq.queue_metrics();
Use active to distinguish expired subscriptions. Raw statistics and completed-history counts have different scope.
Related: Metrics, SQL conventions.