Re: BUG #2830: Wrong results for prepared statements while clustering target table

From: "Martin Pihlak" <martin(dot)pihlak(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2830: Wrong results for prepared statements while clustering target table
Date: 2006-12-17 12:28:58
Message-ID: 3ca0edeb0612170428r6a7ed667jb5451f3ab7b4b2bc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message CN 2006-12-18 04:14:59 BUG #2827
Previous Message Hans 2006-12-17 06:19:29 BUG #2834: installation problem