Implementing queue semantics (novice)

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Implementing queue semantics (novice)
Date: 2005-01-12 13:54:25
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB1653E@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

since I am new to writing stored procedures I'd like to ask first bevore I
do a mistake.

I want to implement some kind of queue (fifo). There are n users/processes
that add new records to a table and there are m consumers that take out
these records and process them.
It's however possible for a consumer to die or loose connection while
records must not be unprocessed. They may rather be processed twice.

This seems to me as a rather common problem. But also with atomicy-holes to
fall into.
How is this commonly implemented?

I can imagine an 'add' and a 'get' function together with one aditional
'processed' timestamp-column?

Thanks for helping me do the right.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Hammond 2005-01-12 16:18:45 Re: Implementing queue semantics (novice)
Previous Message sad 2005-01-12 06:39:59 Re: Single row tables