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

Поиск
Список
Период
Сортировка
От Jinyu
Тема Improve the concurency of vacuum full table and select statement on the same relation
Дата
Msg-id 225e0396.1247d.150525e2523.Coremail.call_jinyu@126.com
обсуждение исходный текст
Ответы Re: Improve the concurency of vacuum full table and select statement on the same relation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">Now vacuum full table takes an
AccessExclusiveLockon relation at start and select statement takes an AccessShareLock on relation. So 'vacuum full
table'blocks select statement on the same table until it is committed and select statement block 'vacuum full table'
untilit is finished. The concurency is very very bad.<br /><br />Proposal:  vacuum full table takes an ExclusiveLock on
relationinstead 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
relationbefore 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.<br /><br />This solution can
improvethe concurency. the following shows the reasons.<br />1. The Function 'copy_heap_data' which copys tuples from
oldrelation to new relation takes most elapsed time of vacuum full table. And it takes an ExclusiveLock on relation
whencall function "copy_heap_data". So select statement on the same relation can't be blocked in the most elapsed time
ofvacuum full table.<br />2. The elapsed time of "finish_heap_swap" is very short, So the blocking time window is very
short.<br/><br />This proposal can also improve the concurency of cluster table and select statement. Because the
executionsteps of cluster table is similar to vacuum full table. The select statement is safe before cluster table call
function"finish_heap_swap".<br /><br />Please let me know if I miss something.<br /><br />Jinyu Zhang<br
/>thanks</div><br/><br /><span title="neteasefooter"><p> </span> 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postgres service stops when I kill client backend on Windows
Следующее
От: Dmitry Vasilyev
Дата:
Сообщение: Re: Postgres service stops when I kill client backend on Windows