From: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Do we really need to switch to per-tuple memory context in ATRewriteTable() when Table Rewrite is not happening |
Date: | 2018-01-03 15:40:46 |
Message-ID: | CAE9k0Pm4po9TWoTF+dLwOtM2be4ak53cTFp1tVd0_tn=aZ6hxA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jan 3, 2018 at 7:25 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> Ashutosh Sharma wrote:
>
>> I am basically talking about the following lines of code in
>> ATRewriteTable() function.
>>
>> /*
>> * Switch to per-tuple memory context and reset it for each tuple
>> * produced, so we don't leak memory.
>> */
>> oldCxt = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
>
> Perhaps a memory context switch is so cheap that adding a branch to
> verify whether it's needed is more expensive than just doing it all the
> time. You could prove me wrong by measuring it.
>
might be...I'm not sure about the cost of context switching. As you
said, it is quite possible that adding a check to verify whether
switching is required or not could be more expensive than doing the
context switching itself.
--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Sharma | 2018-01-03 15:49:25 | Re: Do we really need to switch to per-tuple memory context in ATRewriteTable() when Table Rewrite is not happening |
Previous Message | Jeff Janes | 2018-01-03 15:36:57 | Re: TODO list (was Re: Contributing with code) |