| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: bugfix patch for json_array_elements |
| Date: | 2014-02-03 16:42:12 |
| Message-ID: | 52EFC6E4.5080009@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 02/03/2014 11:12 AM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)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.
>
Good to know.
Is it worth a note in src/backend/utils/mmgr/README so people are warned
against making the same mistake I did? Both of these are set-returning
functions operating in materialize mode - not sure if that makes any
difference.
cheers
andrew
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2014-02-03 16:45:43 | Re: bgworker crashed or not? |
| Previous Message | Andres Freund | 2014-02-03 16:35:59 | Re: slow startup due to LWLockAssign() spinlock |