Re: libpq pipelineing

2021-03-05 Thread Alvaro Herrera
Hello Samuel, On 2020-Jun-27, Samuel Williams wrote: > I found some discussion in the past relating to batch processing which > appears to support some kind of pipelining: > > https://2ndquadrant.github.io/postgres/libpq-batch-mode.html I just noticed this old thread of yours. I've been workin

Re: libpq pipelineing

2020-07-06 Thread Samuel Williams
Hi, Here are some initial numbers. DB::Client Warming up -- db-postgres 281.000 i/100ms db-mariadb 399.000 i/100ms mysql2 533.000 i/100ms pg 591.000 i/100ms Calculating -

Re: libpq pipelineing

2020-06-29 Thread Samuel Williams
Tom, I'm implementing a small abstraction layer for event-driven result streaming on PostgreSQL and MariaDB for Ruby, and I'll endeavor to report back with some numbers once I have enough of it working to benchmark something meaningful. Thanks for your patience and help. Kind regards, Samuel On

Re: libpq pipelineing

2020-06-29 Thread Tom Lane
Samuel Williams writes: > Those methods don't seem to have an equivalent in libpq - you can use > PQgetResult but it buffers all the rows. Using single row mode results > in many results for each query (seems like a big overhead). Have you got any actual evidence for that? Sure, the overhead is

Re: libpq pipelineing

2020-06-29 Thread Stephen Frost
Greetings, * Samuel Williams (space.ship.travel...@gmail.com) wrote: > Here is a short example: > > https://gist.github.com/ioquatix/2f08f78699418f65971035785c80cf18 > > It makes 10 queries in one "PQsendQuery" and sets single row mode. But > all the results come back at once as shown by the tim

Re: libpq pipelineing

2020-06-29 Thread Samuel Williams
I think libmariadb has a nicer interface for this. Essentially what you do is send your query, and then read a result set (one result set per query), and then you stream individual rows using: mysql_fetch_row_start mysql_fetch_row_cont Those methods don't seem to have an equivalent in libpq - yo

Re: libpq pipelineing

2020-06-27 Thread Tom Lane
Samuel Williams writes: > Here is a short example: > https://gist.github.com/ioquatix/2f08f78699418f65971035785c80cf18 > It makes 10 queries in one "PQsendQuery" and sets single row mode. But > all the results come back at once as shown by the timestamps. That looks to be less about what libpq wi

Re: libpq pipelineing

2020-06-27 Thread Samuel Williams
Here is a short example: https://gist.github.com/ioquatix/2f08f78699418f65971035785c80cf18 It makes 10 queries in one "PQsendQuery" and sets single row mode. But all the results come back at once as shown by the timestamps. Next I'm planning to investigate streaming large recordsets to see if it

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > > What about, as it says, sending multiple statements in a single > sendQuery and then polling for multiple results? > > I tried this, and even in single row streaming mode, I found that > there are cases where the results would not be streamed u

Re: libpq pipelineing

2020-06-26 Thread Samuel Williams
> What about, as it says, sending multiple statements in a single sendQuery and > then polling for multiple results? I tried this, and even in single row streaming mode, I found that there are cases where the results would not be streamed until all the queries were sent. >From the users point of

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > Thanks David, > > You are correct. > > I was giving an example of what I was hoping to achieve, not what I > expected to work with the current interface. > What about, as it says, sending multiple statements in a single sendQuery and then pollin

Re: libpq pipelineing

2020-06-26 Thread Samuel Williams
Thanks David, You are correct. I was giving an example of what I was hoping to achieve, not what I expected to work with the current interface. I found some discussion in the past relating to batch processing which appears to support some kind of pipelining: https://2ndquadrant.github.io/postgr

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > Hello, > > Using the asynchronous interface of libpq, is it possible to pipeline > multiple queries? > > i.e. > > PQsendQuery(query1) > PQsendQuery(query2) > > followed by > > query1_results = PQgetResult(...) > query2_results = PQgetResult(...)

libpq pipelineing

2020-06-26 Thread Samuel Williams
Hello, Using the asynchronous interface of libpq, is it possible to pipeline multiple queries? i.e. PQsendQuery(query1) PQsendQuery(query2) followed by query1_results = PQgetResult(...) query2_results = PQgetResult(...) I tried it but got "another command is already in progress" error. So, m