Re: BUG #2830: Wrong results for prepared statements while clustering target table - Mailing list pgsql-bugs

From Martin Pihlak
Subject Re: BUG #2830: Wrong results for prepared statements while clustering target table
Date
Msg-id 3ca0edeb0612170428r6a7ed667jb5451f3ab7b4b2bc@mail.gmail.com
Whole thread Raw
In response to Re: BUG #2830: Wrong results for prepared statements while clustering target table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> The short answer is "don't CLUSTER while the table is in live use" ...
>
This is kind of difficult on a busy database, more so if it's a 24x7
environment. And
unfortunately there aren't any good alternatives either.

> The difference between EXECUTE and SELECT behavior here is just a chance
> matter of exactly where the snap is taken during the parse/execute code
> path --- your SELECT works because it blocks for AccessShareLock on the
> table before it sets the snap.  But SELECT would fail just the same way
> within a serializable transaction that had already set its snapshot.
>

Ok, makes sense. The same reasoning probably applies to INSERT and UPDATE as
well. Still the problem remains - how to cluster a table on a busy
system without losing
data or getting wrong results. Perhaps the issue should be documented,
although a fix
would be preferrable ;)

Martin

pgsql-bugs by date:

Previous
From: "Hans"
Date:
Subject: BUG #2834: installation problem
Next
From: "CN"
Date:
Subject: BUG #2827