Hi, On 2020-08-19 21:29:06 -0400, Tom Lane wrote: > Andres Freund <and...@anarazel.de> writes: > > On 2020-08-19 11:01:37 -0400, Tom Lane wrote: > >> I agree with that, but I think this patch has a bigger problem: > >> why bother at all? It seems like a waste of code space and future > >> maintenance effort, because there is no use-case. > > > I don't agree with this at all. I think there's plenty use cases. It's > > e.g. very common to try to figure out why the memory usage of a process > > is high. Is it memory not returned to the OS? Is it caches that have > > grown too much etc. > > Oh, I agree completely that there are lots of use-cases for finding > out what a process' memory map looks like. But this patch fails to > address any of them in a usable way.
Even just being able to see the memory usage in a queryable way is a huge benefit. The difference over having to parse the log, then parse the memory usage dump, and then aggregate the data in there in a meaningful way is *huge*. We've been slacking around lowering our memory usage, and I think the fact that it's annoying to analyze is a partial reason for that. I totally agree that it's not *enough*, but in contrast to you I think it's a good step. Subsequently we should add a way to get any backends memory usage. It's not too hard to imagine how to serialize it in a way that can be easily deserialized by another backend. I am imagining something like sending a procsignal that triggers (probably at CFR() time) a backend to write its own memory usage into pg_memusage/<pid> or something roughly like that. Greetings, Andres Freund