Re: Alternative for vacuuming queue-like tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
Cc: kmh496 <kmh496(at)kornet(dot)net>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Alternative for vacuuming queue-like tables
Date: 2006-04-28 15:28:41
Message-ID: 1217.1146238121@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Csaba Nagy <nagy(at)ecircle-ag(dot)com> writes:
> I'm not sure how this operation can work in the presence of other long
> running transactions which did not touch the queue table yet, but it
> actually does work, I can confirm that. Is it violating MVCC maybe ?

Yes :-(. I think you can get away with it if all your transactions that
use the queue table run in READ COMMITTED (not serializable) mode, and
if they work like

BEGIN;
LOCK queue_table IN some-suitable-mode;
process queue table;
COMMIT;

Grabbing the lock will ensure that CLUSTER finishes before any snapshot
is taken.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2006-04-28 15:33:58 Re: Alternative for vacuuming queue-like tables
Previous Message Tom Lane 2006-04-28 15:19:20 Re: How to define + operator for strings