From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | reid(dot)thompson(at)crunchydata(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Patch to address creation of PgStat* contexts with null parent context |
Date: | 2022-08-07 02:19:39 |
Message-ID: | 20220807021939.ukavtzwehzu3no4g@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2022-08-05 17:22:38 +0900, Kyotaro Horiguchi wrote:
> I think it a bit different. Previously that memory (but for a bit
> different use, precisely) was required only when stats data is read so
> almost all server processes didn't need it. Now, every server process
> that uses pgstats requires the two memory if it is going to write
> stats. Even if that didn't happen until process termination, that
> memory eventually required to flush possibly remaining data. That
> final write might be avoidable but I'm not sure it's worth the
> trouble. As the result, calling pgstat_initialize() is effectively
> the declaration that the process requires the memory.
I don't think every process will end up calling pgstat_setup_memcxt() -
e.g. walsender, bgwriter, checkpointer probably don't? What do we gain by
creating the contexts eagerly?
> Thus I thought that we may let pgstat_initialize() promptly allocate
> the memory.
That makes some sense - but pgstat_attach_shmem() seems like a very strange
place for the call to CreateCacheMemoryContext().
I wonder if we shouldn't just use TopMemoryContext as the parent for most of
these contexts instead. CacheMemoryContext isn't actually a particularly good
fit anymore.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2022-08-07 02:29:20 | Re: Cleaning up historical portability baggage |
Previous Message | Thomas Munro | 2022-08-07 02:12:56 | Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes? |