prune_message_groups
SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.
Signature
postgremq.prune_message_groups(p_topics character varying[], p_keys character varying[])
RETURNS integer
The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.
Remove unused group metadata
Advanced helper normally called by payload cleanup. Parallel topic/key arrays identify groups to examine. Deletes only groups with no remaining payload anywhere, including DLQ-referenced payloads. Returns removed group count; both empty or NULL arrays produce zero.
Transactions and errors
PMQ03: unequal array cardinalities. Locks candidates in stable order with SKIP LOCKED; groups held by publishers are skipped. Under REPEATABLE READ or SERIALIZABLE it can raise 40001; retry the entire transaction. Pruning does not delete message data.
All calls require the applicable caller privileges. See SQL errors for driver failures and uncertain outcomes.
Example
SELECT postgremq.prune_message_groups(
ARRAY['reference-events']::varchar[], ARRAY['sequence-a']::varchar[]);
A referenced group is retained. Once pruned, later publication using the key can start a new sequence.
Related: Schema and storage, SQL conventions.