Postgresql the right tool (queue using advisory_locks + long transactions)

From: Dorian Hoxha <dorian(dot)hoxha(at)gmail(dot)com>
To: PostgreSql-general <pgsql-general(at)postgresql(dot)org>
Subject: Postgresql the right tool (queue using advisory_locks + long transactions)
Date: 2014-04-27 19:31:42
Message-ID: CANsFX049q7C_vJAtn2BSJy_4hQPu0=JNtv-Lyzb=gbZu-be30A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-04-27 19:53:41 Re: Postgresql the right tool (queue using advisory_locks + long transactions)
Previous Message Rafał Pietrak 2014-04-27 15:21:48 Re: a row not deletes