Queue Management¶
Creating a Queue¶
Unlogged Queues¶
Unlogged queues are faster but do not survive a database crash. Use them for transient, high-throughput data.
Partitioned Queues¶
Partitioned queues split data across multiple tables, improving performance for very large queues.
| Parameter | Description |
|---|---|
partition_interval |
Number of messages per partition. |
retention_interval |
Number of messages to retain in the active partition set. |
Dropping a Queue¶
Dropping a queue removes the queue table and its archive table. Returns True on success.
Listing Queues¶
list_queues() returns a list of QueueRecord objects:
| Attribute | Type | Description |
|---|---|---|
queue_name |
str |
Name of the queue. |
is_partitioned |
bool |
Whether the queue is partitioned. |
is_unlogged |
bool |
Whether the queue is unlogged. |
created_at |
datetime |
Creation timestamp. |
Backward compatibility note: Older versions returned
List[str]. The current version returnsList[QueueRecord]and emits aUserWarningon the sync client. Use.queue_nameto get the string name.
Purging a Queue¶
Remove all messages from a queue without deleting the queue itself:
Validating a Queue Name¶
This delegates validation to pgmq.validate_queue_name() in the database, ensuring your queue name complies with PGMQ naming rules.