Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group