Re: libpq pipelining

From: Matt Newell <newellm(at)blur(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpq pipelining
Date: 2014-12-10 21:29:59
Message-ID: 1499322.vmUVO5HYcT@obsidian
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, December 05, 2014 12:22:38 PM Heikki Linnakangas wrote:
> Oh, that's what the PQgetLastQuery/PQgetNextQuery functions work! I
> didn't understand that before. I'd suggest renaming them to something
> like PQgetSentQuery() and PQgetResultQuery(). The first/last/next names
> made me think that they're used to iterate a list of queries, but in
> fact they're supposed to be used at very different stages.
>
> - Heikki

Okay, I have renamed them with your suggestions, and added
PQsetPipelining/PQgetPipelining, defaulting to pipelining off. There should be
no behavior change unless pipelining is enabled.

Documentation should be mostly complete except the possible addition of an
example and maybe a general pipelining overview paragraph.

I have implemented async query support (that takes advantage of pipelining) in
Qt, along with a couple test cases. This led to me discovering a bug with my
last patch where a PGquery object could be reused twice in a row. I have fixed
that. I contemplated not reusing the PGquery objects at all, but that
wouldn't solve the problem because it's very possible that malloc will return
a recent free of the same size anyway. Making the guarantee that a PGquery
won't be reused twice in a row should be sufficient, and the only alternative is
to add a unique id, but that will add further complexity that I don't think is
warranted.

Feedback is very welcome and appreciated.

Thanks,
Matt Newell

Attachment Content-Type Size
libpq.pipeline.docs.patch text/x-patch 8.5 KB
libpq.pipeline.src.patch text/x-patch 18.6 KB
testlibpqpipeline2.c text/x-csrc 2.3 KB
testlibpqpipeline.c text/x-csrc 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-10 21:50:19 Re: GiST kNN search queue (Re: KNN-GiST with recheck)
Previous Message Arthur Silva 2014-12-10 20:59:43 Re: GiST kNN search queue (Re: KNN-GiST with recheck)