Postgresql the right tool (queue using advisory_locks + long transactions) - Mailing list pgsql-general

From Dorian Hoxha
Subject Postgresql the right tool (queue using advisory_locks + long transactions)
Date
Msg-id CANsFX049q7C_vJAtn2BSJy_4hQPu0=JNtv-Lyzb=gbZu-be30A@mail.gmail.com
Whole thread Raw
Responses Re: Postgresql the right tool (queue using advisory_locks + long transactions)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Postgresql the right tool (queue using advisory_locks + long transactions)  (David G Johnston <david.g.johnston@gmail.com>)
List pgsql-general
Hi list,

I am trying to use postgresql as a queue for long-jobs (max ~4 hours) using advisory_locks. I can't separate the long-job into sub-jobs.

  1. At ultimate-best-case scenario there will be ~100 workers, so no web-scale performance required.
    Is there a problem with 100 open sessions (behind a connection pooler?) for hours like in my case?
    The session will commit the progress of the job, but will stay opened and hold the advisory_lock till the job is done or it expires (look 2).
  2. Is it possible to set a time limit to auto-close an opened session that hasn't made a query in a while ?
    So if a worker fails,and the session time-outs, postgresql/pgbouncer will close the session and release the lock ?

pgsql-general by date:

Previous
From: Rafał Pietrak
Date:
Subject: Re: a row not deletes
Next
From: Tom Lane
Date:
Subject: Re: Postgresql the right tool (queue using advisory_locks + long transactions)