Hi all
Following on from the foreign table batch inserts thread[1], here's a patch to add support for pipelining queries into asynchronous batches in libpq.
It's cleaned up over the draft I posted on that thread and has error recovery implemented. I've written and included the SGML docs for it. The test program is now pretty comprehensive, more so than for anything else in libpq anyway. I'll submit it to the next CF as a 9.7/10.0 candidate.
I'm measuring 300x (not %) performance improvements doing batches on servers over the Internet, so this seems pretty worthwhile. It turned out to be way less invasive than I expected too.
(I intentionally didn't add any way for clients to annotate each work-item in a batch with their own private data. I think that'd be really useful and would make implementing clients easier, but should be a separate patch).
This should be very useful for optimising FDWs, Postgres-XC, etc.