libpq batched parameterized query execution - Mailing list pgsql-interfaces

From James Duong
Subject libpq batched parameterized query execution
Date
Msg-id da267149dbb840f1868fab047ba3ff2d@BY2PR04MB584.namprd04.prod.outlook.com
Whole thread Raw
List pgsql-interfaces
<div class="WordSection1"><p class="MsoNormal">Hi,<p class="MsoNormal"> <p class="MsoNormal">I’m wondering if it’s
possibleto get libpq to batch multiple PQsendQueryParams() calls together.<p class="MsoNormal"> <p class="MsoNormal">It
seemslike currently we have to issue a PQsendQueryParams() call then call PQgetResult() until it returns NULL before we
canstart the execution. What would be good would be either:<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>I can keep sending them while the server is still processing the current one. After sending
themall, I can keep calling PQgetResult() to iterate through them.<p class="MsoListParagraph"
style="text-indent:-18.0pt;mso-list:l0level1 lfo1"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New
Roman"">      </span></span>I can tell libpq “send all these PQsendQueryParams() calls together in one batch” to avoid
excessivenetwork roundtrips.<p class="MsoNormal"> <p class="MsoNormal">Maybe there’s another option I don’t see. COPY
isn’treally a solution, as I’m trying to take generic user input and send it to PostgreSQL as quickly as possible
withoutparsing it. PQexec() can have semi-colon separated queries, but I need real parameters for this case.<p
class="MsoNormal"> <pclass="MsoNormal">Thanks<p class="MsoNormal"> <p class="MsoNormal"><b><span lang="EN-US"
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:EN-CA">James
Duong</span></b><spanlang="EN-US" style="font-size:8.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-CA">
</span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"></span><span
lang="EN-US"style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:EN-CA">Senior
ComputerScientist</span><span lang="EN-US"
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-CA"></span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">Simba Technologies
Inc.</span><pclass="MsoNormal"><span lang="EN-US"
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:EN-CA">Tel+1.604.633.0008
ext.120</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-CA">
</span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA"></span><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">Fax+1.604.633.0004
</span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"></span><span
lang="EN-US"style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:blue;mso-fareast-language:EN-CA"><a
href="mailto:jamesd@simba.com"><spanstyle="color:blue">jamesd@simba.com</span></a></span><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"></span><p
class="MsoNormal"><span
style="font-size:5.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"> </span><p
class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">938West
8<sup>th</sup>Avenue </span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">Vancouver, BC
</span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">Canada
</span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"></span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">V5Z1E5</span><p
class="MsoNormal"><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA">TheData Access and
AnalyticsExperts</span></b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"> </span><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#595959;mso-fareast-language:EN-CA">|</span></b><b><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"> </span></b><span
style="mso-fareast-language:EN-CA"><ahref="http://www.simba.com/"><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:blue;letter-spacing:1.6pt">www.simba.co</span><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:blue">m</span></a></span><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-CA"></span><p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Tahoma","sans-serif";color:#262626;mso-fareast-language:EN-CA"> </span><p
class="MsoNormal"><ahref="http://twitter.com/#!/simbatech"><span
style="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><imgalt="Description: Description: Description:
Description:twitter" border="0" height="16" id="Picture_x0020_13" src="cid:image001.png@01CF9245.DAAC5700" width="16"
/></span></a><spanstyle="color:#262626;mso-fareast-language:EN-CA">  </span><a
href="http://www.youtube.com/user/SimbaTechnologies"><span
style="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><imgalt="Description: Description: Description:
Description:youtube" border="0" height="16" id="Picture_x0020_12" src="cid:image002.png@01CF9245.DAAC5700" width="16"
/></span></a><spanstyle="color:#262626;mso-fareast-language:EN-CA">  </span><a
href="http://ca.linkedin.com/in/simbatechnologies"><span
style="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><imgalt="Description: Description: Description:
Description:linkedin" border="0" height="16" id="Picture_x0020_11" src="cid:image003.png@01CF9245.DAAC5700" width="16"
/></span></a><spanstyle="color:#262626;mso-fareast-language:EN-CA">  </span><a
href="http://www.facebook.com/pages/Simba-Technologies-Inc/163133087033256"><span
style="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><imgalt="Description: Description: Description:
Description:facebook" border="0" height="16" id="Picture_x0020_10" src="cid:image004.png@01CF9245.DAAC5700" width="16"
/></span></a><spanstyle="color:#262626;mso-fareast-language:EN-CA">  </span><a
href="https://plus.google.com/116908198145591559055/posts"><span
style="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><imgalt="Description: Description: Description:
Description:google-plus" border="0" height="16" id="Picture_x0020_9" src="cid:image005.png@01CF9245.DAAC5700"
width="16"/></span></a><span style="color:#262626;mso-fareast-language:EN-CA">  </span><a
href="http://blogs.simba.com/"><spanstyle="color:blue;mso-fareast-language:EN-CA;text-decoration:none"><img
alt="Description:Description: Description: Description: typepad" border="0" height="16" id="Picture_x0020_8"
src="cid:image006.png@01CF9245.DAAC5700"width="16" /></span></a><span
style="color:#262626;mso-fareast-language:EN-CA"></span><pclass="MsoNormal"><span
style="font-size:7.5pt;font-family:"Tahoma","sans-serif";color:gray;mso-fareast-language:EN-CA"> </span><p
class="MsoNormal"><span
style="font-size:7.5pt;font-family:"Tahoma","sans-serif";color:gray;mso-fareast-language:EN-CA">Thisemail message is
forthe sole use of the intended recipient(s) and may contain confidential and privileged information.  Any unauthorized
review,use, disclosure, or distribution is prohibited.  If you are not the intended recipient, please contact the
senderby reply email and destroy all copies of the original message.  Thank you.</span><span
style="font-size:7.5pt;font-family:"Tahoma","sans-serif";color:#1F497D;mso-fareast-language:EN-CA"></span><p
class="MsoNormal"> </div>

pgsql-interfaces by date:

Previous
From: alpha_one_x86
Date:
Subject: Valgrind => break?
Next
From: James Duong
Date:
Subject: libpq single-row mode performance