libpq batched parameterized query execution

From: James Duong <jamesd(at)simba(dot)com>
To: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: libpq batched parameterized query execution
Date: 2014-06-28 03:25:30
Message-ID: da267149dbb840f1868fab047ba3ff2d@BY2PR04MB584.namprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi,

I'm wondering if it's possible to get libpq to batch multiple PQsendQueryParams() calls together.

It seems like currently we have to issue a PQsendQueryParams() call then call PQgetResult() until it returns NULL before we can start the execution. What would be good would be either:

1. I can keep sending them while the server is still processing the current one. After sending them all, I can keep calling PQgetResult() to iterate through them.

2. I can tell libpq "send all these PQsendQueryParams() calls together in one batch" to avoid excessive network roundtrips.

Maybe there's another option I don't see. COPY isn't really a solution, as I'm trying to take generic user input and send it to PostgreSQL as quickly as possible without parsing it. PQexec() can have semi-colon separated queries, but I need real parameters for this case.

Thanks

James Duong | Senior Computer Scientist | Simba Technologies Inc.
Tel +1.604.633.0008 ext. 120 | Fax +1.604.633.0004 | jamesd(at)simba(dot)com<mailto:jamesd(at)simba(dot)com>

938 West 8th Avenue | Vancouver, BC | Canada | V5Z 1E5
The Data Access and Analytics Experts | www.simba.com<http://www.simba.com/>

[Description: Description: Description: Description: twitter]<http://twitter.com/#!/simbatech> [Description: Description: Description: Description: youtube] <http://www.youtube.com/user/SimbaTechnologies> [Description: Description: Description: Description: linkedin] <http://ca.linkedin.com/in/simbatechnologies> [Description: Description: Description: Description: facebook] <http://www.facebook.com/pages/Simba-Technologies-Inc/163133087033256> [Description: Description: Description: Description: google-plus] <https://plus.google.com/116908198145591559055/posts> [Description: Description: Description: Description: typepad] <http://blogs.simba.com/>

This email message is for the 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 sender by reply email and destroy all copies of the original message. Thank you.

Browse pgsql-interfaces by date

  From Date Subject
Next Message James Duong 2014-07-03 01:05:32 libpq single-row mode performance
Previous Message alpha_one_x86 2014-06-24 09:44:35 Valgrind => break?