Multiple call of GetTransactionSnapshot in single flow - Mailing list pgsql-hackers

From Rajeev rastogi
Subject Multiple call of GetTransactionSnapshot in single flow
Date
Msg-id BF2827DCCE55594C8D7A8F7FFD3AB77158E6129F@SZXEML508-MBX.china.huawei.com
Whole thread Raw
Responses Re: Multiple call of GetTransactionSnapshot in single flow  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<div class="WordSection1"><p class="MsoNormal">I have observed  in some places like exec_bind_message  and
exec_simple_query,<p class="MsoNormal">Though these two function have already got snapshot but before they call
functionPortalStart, <p class="MsoNormal">current snapshot gets popped off and then they pass InvalidSnapshot  as
parameter<p class="MsoNormal">because of which inside PortalStart again snapshot is taken.<p class="MsoNormal"> <p
class="MsoNormal">Incases where many transactions are running, taking snapshot multiple times may be very costly.<p
class="MsoNormal"> <pclass="MsoNormal">What is the reason for taking snapshot multiple time:<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0level1 lfo1"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New
Roman"">      </span></span>Is this implementation to make sure snapshot is at more granular level ?<p
class="MsoListParagraph"style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">2.<span
style="font:7.0pt"Times New Roman"">       </span></span>Is it something do with current command id of the snapshot?<p
class="MsoListParagraph"style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">3.<span
style="font:7.0pt"Times New Roman"">       </span></span>Or there is any other specific reason for this, which I am not
ablevisualize?<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><span
style="mso-list:Ignore">4.<spanstyle="font:7.0pt "Times New Roman"">       </span></span>Or am I missing something
else?<pclass="MsoNormal"> <p class="MsoNormal">If it is just reason 1, then maybe we can try to pass the same snapshot
toPortalStart as taken in caller, it can enhance the performance in many case.<p class="MsoNormal"
style="text-autospace:none">Withthis change, I  did one small performance test on pgbench with “<b><i><span
style="font-size:12.0pt;font-family:"Cambria","serif";color:black">preparedqueries for pgbench select with 16
users</span></i></b><b><spanstyle="font-size:12.0pt;font-family:"Cambria","serif";color:black"> and observed
performancebenefit of 10%</span></b><span style="font-size:10.0pt;font-family:"Cambria","serif";color:black">”.
</span><pclass="MsoNormal"> <p class="MsoNormal">Please provide your opinion?<i><u><span
style="color:black"></span></u></i><pclass="MsoNormal"><i><span style="color:black"> </span></i><p
class="MsoNormal"><i><spanstyle="color:black">Thanks and Regards,</span></i><p class="MsoNormal"><i>Kumar Rajeev
Rastogi<spanstyle="color:black"> </span></i><p class="MsoNormal"> </div> 

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: psql \watch always ignores \pset null
Next
From: Etsuro Fujita
Date:
Subject: Re: inherit support for foreign tables