From: | Samuel Williams <space(dot)ship(dot)traveller(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: libpq pipelineing |
Date: | 2020-06-29 12:44:21 |
Message-ID: | CAHkN8V_FgaXz+E_+Geaxw-Jv4_g9c2P-bxkNqPGysYYu=XOgMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 - 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). The
difference between this and MariaDB is that mysql_fetch_row still
operates within one logical set of results, but single row mode breaks
the single logical set of results into lots of individual results.
Maybe the statement about efficiency is incorrect, but it would be
nice if you could incrementally stream a single result set more
easily.
On Sun, 28 Jun 2020 at 02:40, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Samuel Williams <space(dot)ship(dot)traveller(at)gmail(dot)com> 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 will do than what the Ruby
> interface code will do.
>
> The volume of return data may also be an issue. I don't think the
> backend will flush data out to the client except when it (a) reaches
> an idle state or (b) fills the output buffer. Ten occurrences of
> a short query result aren't gonna be enough for (b) --- from memory,
> that buffer is probably 8KB.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-06-29 13:02:22 | Re: Help - Need 9.3 for Centos - recovery of legacy system |
Previous Message | Brad Thompson | 2020-06-29 12:04:18 | Help - Need 9.3 for Centos - recovery of legacy system |