pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Konstantinos Krikellas <K.Krikellas@sms.ed.ac.uk>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Disable result buffering to frontend clients
Date: Thu, 22 Feb 2007 11:12:11 +0000
Message-ID: <45DD7A8B.3040001@archonet.com> (raw)
In-Reply-To: <1172142170.4718.13.camel@kkrik-desktop>
References: <1172142170.4718.13.camel@kkrik-desktop>

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



view thread (2+ messages)

Message-ID: <45DD7A8B.3040001@archonet.com>
Permalink:  ../45DD7A8B.3040001@archonet.com/
Also on:    postgresql.org/message-id/45DD7A8B.3040001@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, K.Krikellas@sms.ed.ac.uk
  Subject: Re: Disable result buffering to frontend clients
  In-Reply-To: <45DD7A8B.3040001@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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