Pivotal Knowledge Base

Follow

Database query run via psql fails with error "out of memory for query result'"

Environment

Product Version
Pivotal Greenplum(GPDB)  All versions

Symptom

Database query running from psql fails with an error.

Error Message:

xx=# select * from xx where xxx=xxx;
out of memory for query result

Cause

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.

Resolution

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 >

Additional Information

Check the psql documentation for more information on the parameter.

Comments

Powered by Zendesk