From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Backend memory dump analysis |
Date: | 2018-03-26 03:16:33 |
Message-ID: | CAMsr+YFUS48_bmgXaR4G+wCDquNUtpC_dMQgJFAqEU1FcgCjOg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 24 March 2018 at 03:01, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Hi,
>
> On 2018-03-23 14:33:25 -0400, Tom Lane wrote:
> > func_cxt = AllocSetContextCreate(TopMemoryContext,
> > "PL/pgSQL function context",
> > ALLOCSET_DEFAULT_SIZES);
> > plpgsql_compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
> >
> > function->fn_signature = format_procedure(fcinfo->flinfo->fn_oid);
> > + MemoryContextSetIdentifier(func_cxt, function->fn_signature);
> > function->fn_oid = fcinfo->flinfo->fn_oid;
> > function->fn_xmin = HeapTupleHeaderGetRawXmin(procTup->t_data);
> >
> > This would cost an extra char * field in struct MemoryContextData,
> > which is slightly annoying but it doesn't exactly seem like a killer.
> > Then the memory stats dump code would just need to know to print this
> > field if it isn't NULL.
>
> That's not a bad idea. How about storing a Node* instead of a char*?
> Then we could have MemoryContextStats etc support digging out details
> for a few types, without having to generate strings at runtime.
>
That'd render it pretty useless for extensions, though.
I like the idea of being able to introspect state for particular kinds of
contexts, and not have to generate strings that 99.99% of the time won't
get get looked at.
Function pointers instead of char* ? It adds a significant potential
stability risk to MemoryContextStats() calls, but a great deal of
flexibility.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2018-03-26 03:27:31 | Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility |
Previous Message | Craig Ringer | 2018-03-26 03:14:41 | Re: Backend memory dump analysis |