pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Disable result buffering to frontend clients
2+ messages / 2 participants
[nested] [flat]

* Disable result buffering to frontend clients
@ 2007-02-22 11:02 Konstantinos Krikellas <K.Krikellas@sms.ed.ac.uk>
  2007-02-22 11:12 ` Re: Disable result buffering to frontend clients Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Konstantinos Krikellas @ 2007-02-22 11:02 UTC (permalink / raw)
  To: pgsql-performance

Hi,

I am trying to execute some queries in PostgreSQL that produce a large
number of results and I do not want to display the output (redirect it
to /dev/null). I have tried the psql client with \o /dev/null option,
JDBC and libpq functions, but all of them have to buffer totally the
result before redirecting it. Is there any way to disable result
buffering, either on the client or on the server side? Note that the
EXPLAIN ANALYSE does not produce consistent estimations as it seems to
avoid calling the result tuple construction function. This is concluded
by the fact that augmenting the projection width hardly changes the
execution time, which is incompatible with the supplementary field copy
cost.

Thanks.
Konstantinos Krikellas




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Disable result buffering to frontend clients
  2007-02-22 11:02 Disable result buffering to frontend clients Konstantinos Krikellas <K.Krikellas@sms.ed.ac.uk>
@ 2007-02-22 11:12 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2007-02-22 11:12 UTC (permalink / raw)
  To: Konstantinos Krikellas <K.Krikellas@sms.ed.ac.uk>; +Cc: pgsql-performance

Konstantinos Krikellas wrote:
> Hi,
> 
> I am trying to execute some queries in PostgreSQL that produce a large
> number of results and I do not want to display the output (redirect it
> to /dev/null). I have tried the psql client with \o /dev/null option,
> JDBC and libpq functions, but all of them have to buffer totally the
> result before redirecting it. Is there any way to disable result
> buffering, either on the client or on the server side? 

Well, you could use a cursor, but that could change the plan (I believe 
it favours plans that return the first result quickly).

You could have a function that used FOR-IN-EXECUTE to run a query for 
you then just loop through the results, doing nothing. That would keep 
everything server-side.

If you really want to duplicate all the query costs except client-side 
buffering, the simplest might be to just hack the libpq source to 
discard any query results rather than buffering them - shouldn't be too 
difficult.

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-02-22 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-22 11:02 Disable result buffering to frontend clients Konstantinos Krikellas <K.Krikellas@sms.ed.ac.uk>
2007-02-22 11:12 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox