Re: Protect syscache from bloating with negative cache entries

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Protect syscache from bloating with negative cache entries
Дата
Msg-id 20190205220526.GA1442@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Protect syscache from bloating with negative cache entries  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: Protect syscache from bloating with negative cache entries  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Re: Protect syscache from bloating with negative cache entries  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Re: Protect syscache from bloating with negative cache entries  ("MauMau" <maumau307@gmail.com>)
Список pgsql-hackers
On 2019-Feb-05, Tomas Vondra wrote:

> I don't think we need to remove the expired entries right away, if there
> are only very few of them. The cleanup requires walking the hash table,
> which means significant fixed cost. So if there are only few expired
> entries (say, less than 25% of the cache), we can just leave them around
> and clean them if we happen to stumble on them (although that may not be
> possible with dynahash, which has no concept of expiration) of before
> enlarging the hash table.

I think seqscanning the hash table is going to be too slow; Ideriha-san
idea of having a dlist with the entries in LRU order (where each entry
is moved to head of list when it is touched) seemed good: it allows you
to evict older ones when the time comes, without having to scan the rest
of the entries.  Having a dlist means two more pointers on each cache
entry AFAIR, so it's not a huge amount of memory.

> So if we want to address this case too (and we probably want), we may
> need to discard the old cache memory context someho (e.g. rebuild the
> cache in a new one, and copy the non-expired entries). Which is a nice
> opportunity to do the "full" cleanup, of course.

Yeah, we probably don't want to do this super frequently though.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Bogus lateral-reference-propagation logic in create_lateral_join_info
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fixing findDependentObjects()'s dependency on scan order (regressions in DROP diagnostic messages)