Re: Improve the concurency of vacuum full table and select statement on the same relation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jinyu <call_jinyu(at)126(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Improve the concurency of vacuum full table and select statement on the same relation
Date: 2015-10-10 15:34:41
Message-ID: 48375.1444491281@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jinyu <call_jinyu(at)126(dot)com> writes:
> Proposal: vacuum full table takes an ExclusiveLock on relation instead of AccessExclusiveLock at start. It can' block select statement before call function "finish_heap_swap". and select statement is safe because vacuum full table copys tuples from old relation to new relation before calling function "finish_heap_swap". But it must take an AccessExclusiveLock on relation when call function "finish_heap_swap" in order to block select statement on the same relation.

> This solution can improve the concurency. the following shows the reasons.

What it's more likely to do is cause the vacuum full to fail altogether,
after doing a lot of work. Lock upgrade is a bad thing because it tends
to result in deadlocks.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-10-10 15:55:56 Re: Postgres service stops when I kill client backend on Windows
Previous Message Dmitry Vasilyev 2015-10-10 15:33:21 Re: Postgres service stops when I kill client backend on Windows