Re: 'COPY ... FROM' inserts to btree, blocks on buffer

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: 'COPY ... FROM' inserts to btree, blocks on buffer
Дата
Msg-id 1104615013.3978.1301.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, 2005-01-01 at 18:55, Tom Lane wrote:
> Simon Riggs <simon@2ndquadrant.com> writes:
> > I think the proposal sounds safe, though I worry about performance.
> 
> There is no performance loss; we are just changing the order in which
> we acquire two locks.  If there were some risk of blocking for a
> measurable time while holding the BufMgrLock, then that would be bad for
> concurrent performance --- but in fact the per-buffer lock is guaranteed
> free at that point.
> 
> I don't think there's any value in trying to avoid the I/O.  This is a
> corner case of such rarity that it's only been seen perhaps half a dozen
> times in the history of the project.  "Optimizing" it is not the proper
> concern.  The case where the I/O is wasted because someone re-pins the
> buffer during the write is far more likely, simply because of the
> relative widths of the windows involved; and we can't avoid that.

The deadlock is incredibly rare, I agree. That was not my point.

The situation where another backend requests the block immediately
before the I/O is fairly common AFAICS, especially since
StrategyGetBuffer ignores the BM_DIRTY flag in selecting victims.

ISTM making the code deadlock-safe will effect cases where there never
would have been a deadlock, slowing both backends down while waiting for
the I/O to complete.

> Bottom line is that I don't think it's useful to consider this as a
> performance issue.  What we need is correctness with minimum extra
> complication of the logic.

I'll step aside and look more closely for 8.1

-- 
Best Regards, Simon Riggs



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: [PATCHES] Bgwriter behavior
Следующее
От: Korry
Дата:
Сообщение: Re: exception handling in plpgsql