Re: Incremental results from libpq

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-interfaces(at)postgresql(dot)org, Scott Lamb <slamb(at)slamb(dot)org>
Subject: Re: Incremental results from libpq
Date: 2005-11-16 14:24:24
Message-ID: 5329.1132151064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Am Mittwoch, 9. November 2005 22:22 schrieb Tom Lane:
>> The main reason why libpq does what it does is that this way we do not
>> have to expose in the API the notion of a command that fails part way
>> through.

> I'm at LinuxWorld Frankfurt and one of the Trolltech guys came over to talk to
> me about this. He opined that it would be beneficial for their purpose (in
> certain cases) if the server would first compute the entire result set and
> keep it in the server memory (thus eliminating potential errors of the 1/x
> kind) and then ship it to the client in a way that the client would be able
> to fetch it piecewise. Then, the client application could build the display
> incrementally while the rest of the result set travels over the (slow) link.
> Does that make sense?

Ick. That seems pretty horrid compared to the straight
incremental-compute-and-fetch approach. Yes, it preserves the illusion
that a SELECT is all-or-nothing, but at a very high cost, both in terms
of absolute runtime and in terms of needing a new concept in the
frontend protocol. It also doesn't solve the problem for people who
need incremental fetch because they have a result set so large they
don't want it materialized on either end of the wire. Furthermore, ISTM
that any client app that's engaging in incremental fetches really has to
deal with the failure-after-part-of-the-query-is-done problem anyway,
because there's always a risk of failures on the client side or in the
network connection. So I don't see any real gain in conceptual
simplicity from adding this feature anyway.

Note that if Trolltech really want this behavior, they can have it today
--- it's called CREATE TEMP TABLE AS SELECT. It doesn't seem attractive
enough to me to justify any further feature than that.

regards, tom lane

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Goulet, Dick 2005-11-16 14:57:27 Re: Incremental results from libpq
Previous Message Magnus Hagander 2005-11-16 09:57:15 Re: Incremental results from libpq