Re: Add pg_stat_vfdcache view for VFD cache statistics - Mailing list pgsql-hackers

From Ayoub Kazar
Subject Re: Add pg_stat_vfdcache view for VFD cache statistics
Date
Msg-id CADu+CpSY57xpQsGr1CAESUHxGv_Y3_aABmkHC-Gh9GpEG3tpPw@mail.gmail.com
Whole thread
In response to Add pg_stat_vfdcache view for VFD cache statistics  (KAZAR Ayoub <ma_kazar@esi.dz>)
List pgsql-hackers
On Mon, Sep 7, 2026 at 8:49 AM David Geier <geidav.pg@gmail.com> wrote:
>>> what GetMemoryChunkSpace() works on IIUC.
>>> Am i correct here?
>> That's interesting an interesting realization. You're right that we
>> cannot use GetMemoryChunkSpace() in that case.
>>
>> However, I'm wondering if the better approach wouldn't be to change fd.c
>> to use a long-lived memory context. Then all bookkeeping would happen
>> automatically and the memory size could simply be reported via existing
>> memory context stats infrastructure.
>>
>> Not entirely sure though if there's some roadblock when switching to a
>> memory context.
> I don't see any issue with this either. However, the only benefit we would
> gain is using existing infrastructure but only for backend vfd cache memory
> (i.e cache_bytes).
> Everything else stays the same (counters, cluster-wide memory); therefore,
> if there's no other benefit to replacing with memory contexts, maybe it's
> not worth it.

The biggest benefit in my view is consistency with the rest of PostgreSQL.
That is from a usage point of view as well as from a coding point of view.
If you want, I can give that a try and share a patch with you if successful.
Yes of course, I’d be happy to take a look.  

Regards,
Ayoub

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: [DOC] pg_database_size/pg_tablespace_size error on a missing OID
Next
From: Amit Kapila
Date:
Subject: Re: Follow-up review items for update_deleted