From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Savepoints in transactions for speed? |
Date: | 2012-11-29 20:25:53 |
Message-ID: | CAMkU=1x39=Kf7czJN15HF=u03uFr5oWn8rv7mP1WokB4P8AkCQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Thu, Nov 29, 2012 at 10:14 AM, Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com> wrote:
>
>
>
> On Thu, Nov 29, 2012 at 12:09 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
>>
>>
>> But If you do keep the drop index inside the transaction, then you
>> would probably be better off using truncate rather than delete, and
>> rebuild the index non-concurrently and move that inside the
>> transaction as well.
>>
>
>
> Hmm.... From the 9.2 manual it seems that might not work out so well:
>
> TRUNCATE is not MVCC-safe (see Chapter 13 for general information about
> MVCC). After truncation, the table will appear empty to all concurrent
> transactions, even if they are using a snapshot taken before the truncation
> occurred.
>
> It looks like other transactions could find an empty table while it was
> being reloaded under that approach.
They would block during the load, it is just after the load that they
would see the table as empty. I thought that that would only be a
problem for repeatable read or higher, but a test shows that read
committed has that problem as well. But yeah, that could definitely
be a problem with that method.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Niels Kristian Schjødt | 2012-11-30 00:59:00 | Re: Optimize update query |
Previous Message | Claudio Freire | 2012-11-29 19:58:06 | Re: Savepoints in transactions for speed? |