Re: Protect syscache from bloating with negative cache entries

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, "Ideriha, Takeshi" <ideriha(dot)takeshi(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, "michael(dot)paquier(at)gmail(dot)com" <michael(dot)paquier(at)gmail(dot)com>, "david(at)pgmasters(dot)net" <david(at)pgmasters(dot)net>, "Jim(dot)Nasby(at)bluetreble(dot)com" <Jim(dot)Nasby(at)bluetreble(dot)com>, "craig(at)2ndquadrant(dot)com" <craig(at)2ndquadrant(dot)com>
Subject: Re: Protect syscache from bloating with negative cache entries
Date: 2019-01-17 19:48:51
Message-ID: 20190117194851.GG10895@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 17, 2019 at 11:33:35AM -0500, Robert Haas wrote:
> The flaw in your thinking, as it seems to me, is that in your concern
> for "the likelihood that cache flushes will simply remove entries
> we'll soon have to rebuild," you're apparently unwilling to consider
> the possibility of workloads where cache flushes will remove entries
> we *won't* soon have to rebuild. Every time that issue gets raised,
> you seem to blow it off as if it were not a thing that really happens.
> I can't make sense of that position. Is it really so hard to imagine
> a connection pooler that switches the same connection back and forth
> between two applications with different working sets? Or a system
> that keeps persistent connections open even when they are idle? Do
> you really believe that a connection that has not accessed a cache
> entry in 10 minutes still derives more benefit from that cache entry
> than it would from freeing up some memory?

Well, I think everyone agrees there are workloads that cause undesired
cache bloat. What we have not found is a solution that doesn't cause
code complexity or undesired overhead, or one that >1% of users will
know how to use.

Unfortunately, because we have not found something we are happy with, we
have done nothing. I agree LRU can be expensive. What if we do some
kind of clock sweep and expiration like we do for shared buffers? I
think the trick is figuring how frequently to do the sweep. What if we
mark entries as unused every 10 queries, mark them as used on first use,
and delete cache entries that have not be used in the past 10 queries.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-01-17 20:42:00 Re: Fixing findDependentObjects()'s dependency on scan order (regressions in DROP diagnostic messages)
Previous Message Tom Lane 2019-01-17 19:31:30 Re: Feature: temporary materialized views