Re: Protect syscache from bloating with negative cache entries - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Protect syscache from bloating with negative cache entries
Date
Msg-id 20171201213113.z4gbol66ipvg5b4o@alap3.anarazel.de
Whole thread Raw
In response to Re: Protect syscache from bloating with negative cache entries  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Protect syscache from bloating with negative cache entries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2017-12-01 16:20:44 -0500, Robert Haas wrote:
> Well, yeah, that would be insane.  But I think even something very
> rough could work well enough.  I think our goal should be to eliminate
> cache entries that are have gone unused for many *minutes*, and
> there's no urgency about getting it to any sort of exact value.  For
> non-idle backends, using the most recent statement start time as a
> proxy would probably be plenty good enough.  Idle backends might need
> a bit more thought.

Our timer framework is flexible enough that we can install a
once-a-minute timer without much overhead. That timer could increment a
'cache generation' integer. Upon cache access we write the current
generation into relcache / syscache (and potentially also plancache?)
entries. Not entirely free, but cheap enough. In those once-a-minute
passes entries that haven't been touched in X cycles get pruned.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Protect syscache from bloating with negative cache entries
Next
From: Tom Lane
Date:
Subject: Re: Protect syscache from bloating with negative cache entries