Re: Alternative for vacuuming queue-like tables - Mailing list pgsql-general

From Tom Lane
Subject Re: Alternative for vacuuming queue-like tables
Date
Msg-id 1217.1146238121@sss.pgh.pa.us
Whole thread Raw
In response to Re: Alternative for vacuuming queue-like tables  (Csaba Nagy <nagy@ecircle-ag.com>)
Responses Re: Alternative for vacuuming queue-like tables
List pgsql-general
Csaba Nagy <nagy@ecircle-ag.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to define + operator for strings
Next
From: Csaba Nagy
Date:
Subject: Re: Alternative for vacuuming queue-like tables