Single Row Mode in psql - Mailing list pgsql-general

From Christopher Manning
Subject Single Row Mode in psql
Date
Msg-id CAEYkp90OoiMGnDqsWf=w2rWFz07so6hrbzr3U1aFH4EkiL=AEg@mail.gmail.com
Whole thread Raw
List pgsql-general
I'm using psql to extract data from a redshift (based on postgres) instance, but psql/libpq collects the result in memory before writing it to a file and causes out of memory problems for large results. Using COPY TO STDOUT or FETCH_COUNT isn't an option since redshift doesn't support those.

[Single Row Mode is available in postgres 9.2](http://www.postgresql.org/docs/9.2/static/libpq-single-row-mode.html) but [it doesn't look like](http://www.postgresql.org/docs/9.2/static/app-psql.html) you can tell psql to use it when writing to a file (using --output).

Is it currently possible to have psql --output to a file using single row mode?

Thank you,
Christopher

P.S. The ruby-pg gem supports single row mode: https://bitbucket.org/ged/ruby-pg/src/de1cdb0f7ba625ad7cec02bb871ae8fdf7de68c8/ext/pg_connection.c?at=default#cl-1514 but it has the overhead of being a ruby script instead of psql supporting it.

pgsql-general by date:

Previous
From: François Beausoleil
Date:
Subject: Re: Most efficient way to insert without duplicates
Next
From: Mike Roest
Date:
Subject: Re: Fetching Server configured port from C Module