Thread: psql buffering

psql buffering

From
Joseph Shraibman
Date:
If I give psql the -A option, does it still wait for all the data to come in before
starting output?


Re: psql buffering

From
Martijn van Oosterhout
Date:
On Fri, Aug 29, 2003 at 05:10:07PM -0400, Joseph Shraibman wrote:
> If I give psql the -A option, does it still wait for all the data to come
> in before starting output?

Because it's still using libpq to do the queries and it doesn't return until
it has retrieved the entire dataset.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "All that is needed for the forces of evil to triumph is for enough good
> men to do nothing." - Edmond Burke
> "The penalty good people pay for not being interested in politics is to be
> governed by people worse than themselves." - Plato

Attachment

Re: psql buffering

From
Joseph Shraibman
Date:
Are all interfaces like that?

Martijn van Oosterhout wrote:
> On Fri, Aug 29, 2003 at 05:10:07PM -0400, Joseph Shraibman wrote:
>
>>If I give psql the -A option, does it still wait for all the data to come
>>in before starting output?
>
>
> Because it's still using libpq to do the queries and it doesn't return until
> it has retrieved the entire dataset.
>



Re: psql buffering

From
Martijn van Oosterhout
Date:
Hmm, most of them yes. You can only run one command at a time anyway. They way
most programs deal is to make cursors for the queries and then fetch say
1000 rows at a time. This way they can process data without having to wait
for the backend.

That said, I do beleive that libpq does have the facility to read the data
as it comes in (at least, I assume that's what PQsendQuery/PQconsumeInput
are for). It's a little more involved. I've never used it since cursors
solve the problem for me and are much easier to understand.

Hope this helps,

On Sat, Aug 30, 2003 at 10:19:10PM -0400, Joseph Shraibman wrote:
> Are all interfaces like that?
>
> Martijn van Oosterhout wrote:
> >On Fri, Aug 29, 2003 at 05:10:07PM -0400, Joseph Shraibman wrote:
> >
> >>If I give psql the -A option, does it still wait for all the data to come
> >>in before starting output?
> >
> >
> >Because it's still using libpq to do the queries and it doesn't return
> >until
> >it has retrieved the entire dataset.
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "All that is needed for the forces of evil to triumph is for enough good
> men to do nothing." - Edmond Burke
> "The penalty good people pay for not being interested in politics is to be
> governed by people worse than themselves." - Plato

Attachment