Re: bugfix patch for json_array_elements - Mailing list pgsql-hackers

From Tom Lane
Subject Re: bugfix patch for json_array_elements
Date
Msg-id 31857.1391443920@sss.pgh.pa.us
Whole thread Raw
In response to Re: bugfix patch for json_array_elements  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: bugfix patch for json_array_elements  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 02/02/2014 08:54 PM, Craig Ringer wrote:
>> The attached patch deletes the context after use, bringing performance
>> back into line. It should be backpatched to 9.3.

> Hmm. I guess I was assuming that the tmp_cxt would be cleaned up at the 
> end of the function since it's a child of the CurrentMemoryContext.

The executor does MemoryContextReset, not
MemoryContextResetAndDeleteChildren, on the per-tuple context.  That means
that child contexts will be reset, not deleted.  I seem to recall some
discussions about changing that, or even redefining MemoryContextReset to
automatically delete child contexts; but it would take a fair amount of
research to be sure such a change was safe.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: GIN improvements part2: fast scan
Next
From: "Tomas Vondra"
Date:
Subject: Re: GIN improvements part2: fast scan