From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Konstantinos Krikellas <K(dot)Krikellas(at)sms(dot)ed(dot)ac(dot)uk> |
Cc: | pgsql-performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Disable result buffering to frontend clients |
Date: | 2007-02-22 11:12:11 |
Message-ID: | 45DD7A8B.3040001@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel Biberian | 2007-02-22 18:11:42 | slow update on 1M rows (worse with indexes) |
Previous Message | Konstantinos Krikellas | 2007-02-22 11:02:50 | Disable result buffering to frontend clients |