X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECF723A5CAC for ; Wed, 12 Jan 2005 13:54:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20563-01 for ; Wed, 12 Jan 2005 13:54:29 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id 6E36F3A5AEB for ; Wed, 12 Jan 2005 13:54:31 +0000 (GMT) Received: (qmail-ldap/ctrl 91614 invoked from network); 12 Jan 2005 13:54:28 -0000 Received: from unknown (HELO jupiter.sonorys.at) ([213.235.243.42]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with SMTP for ; 12 Jan 2005 13:54:28 -0000 Received: from neptun.sonorys.at (neptun.sonorys.at [172.24.1.17]) by jupiter.sonorys.at (8.11.7+Sun/8.11.7) with ESMTP id j0CDsds02442 for ; Wed, 12 Jan 2005 14:54:39 +0100 (MET) Received: by neptun.sonorys.at with Internet Mail Service (5.5.2653.19) id ; Wed, 12 Jan 2005 14:54:30 +0100 Message-ID: From: =?iso-8859-1?Q?K=D6PFERL_Robert?= To: "'pgsql-sql@postgresql.org'" Subject: Implementing queue semantics (novice) Date: Wed, 12 Jan 2005 14:54:25 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/52 X-Sequence-Number: 19840 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.