Re: Double linking MemoryContext children - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Double linking MemoryContext children
Date
Msg-id 15890.1442073090@sss.pgh.pa.us
Whole thread Raw
In response to Re: Double linking MemoryContext children  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers
Kevin Grittner <kgrittn@ymail.com> writes:
> I guess the question is whether to add a pointer for each memory
> context to give the MemoryContextSetParent() function O(1)
> performance characteristics or add comments in front of this
> function to document how callers should organize their code to
> avoid O(N^2) performance.  I generally prefer that callers of such
> a function need not be that aware of implementation details, so I
> would prefer the former.

On reflection, it's a bit silly to complain about one extra pointer per
MemoryContext, when the memory represented by the context is going to be
at least one kilobyte and usually a lot more.  So I withdraw my objection
to the concept.  I concur that we'd just as soon not worry about what
order things are done in.

> On the other hand, a grep indicates that there are two places that
> MemoryContextData.nextchild is set (and we therefore probably need
> to also set the new field), and Jan's proposed patch only changes
> one of them.  If we do this, I think we need to change both places
> that are affected, so ResourceOwnerCreate() in resowner.c would
> need a line or two added.

Um.  Sounds like it needs some actual code review then ...
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Double linking MemoryContext children
Next
From: Pavel Stehule
Date:
Subject: Re: On-demand running query plans using auto_explain and signals