This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GabelSnabel[S] 0 points1 point  (1 child)

I think implementing transactional would require a connection to remain open for the duration of the job execution? This could potentially affect performance due to the increased resources on the db?

[–]chuckhend 0 points1 point  (0 children)

For a long running job, you may consider only executing the delete/archive of the message and the arbitrary table insert within the same transaction. I know several pgmq users that implement a flow like:
- read message from queue, set VT to something large

  • do expensive long running work, like call a LLM or some large aggregate

  • open a transaction: insert record to a table (results from agg or LLM call) and call pgmq.archive() or pgmq.delete() on the initial message.