Pivotal Greenplum (GPDB) all versions
Database query running from psql fails with an error.
xx=# select * from xx where xxx=xxx; out of memory for query result
When the query is returning to the dataset (which has to be displayed by the psql tool); the psql application runs short of memory and the error displays on the screen.
Set FETCH_COUNT > 0 to provide how many rows of data have to be fetched and grouped to display the output.
This parameter will reduce the data to be fetched and displayed in group of that much rows rather than displaying the entire data set after it has been fetched (which is the default behavior).
\set FETCH_COUNT 1000 < run the query >
Check the psql documentation for more information on the parameter.