Re: plan with result cache is very slow when work_mem is not enough - Mailing list pgsql-hackers

From David Rowley
Subject Re: plan with result cache is very slow when work_mem is not enough
Date
Msg-id CAApHDvqn17xP4yVkoYsTNu4X=1srN62z_MK5Wfca-Of1h_-Ycw@mail.gmail.com
Whole thread Raw
In response to Re: plan with result cache is very slow when work_mem is not enough  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
On Sat, 8 May 2021 at 14:43, Justin Pryzby <pryzby@telsasoft.com> wrote:
> You could put this into a separate function called by ExecEndResultCache().
> Then anyone that breaks the memory accounting can also call the function in the
> places they changed to help figure out what they broke.

I almost did it that way and left a call to it in remove_cache_entry()
#ifdef'd out.  However, as mentioned, I'm more concerned about the
accounting being broken and left broken than I am with making it take
a little less time to find the exact place to fix the breakage.  If
the breakage was to occur when adding a new entry to the cache then it
might not narrow it down much if we just give users an easy way to
check the memory accounting during only evictions. The only way to
highlight the problem as soon as it occurs would be to validate the
memory tracking every time the mem_used field is changed. I think that
would be overkill.

I also find it hard to imagine what other reasons we'll have in the
future to adjust 'mem_used'.  At the moment there are 4 places. Two
that add bytes and two that subtract bytes. They're all hidden inside
reusable functions that are in charge of adding and removing entries
from the cache.

David



pgsql-hackers by date:

Previous
From: Japin Li
Date:
Subject: Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns
Next
From: Noah Misch
Date:
Subject: Re: Anti-critical-section assertion failure in mcxt.c reached by walsender