#4943·postgrest

PostgREST OOM crash when handling multiple large result sets

Author: mkleczekCreated May 19, 2026Updated Sep 9, 2026
Labelsperfneeds repro

Environment

  • PostgreSQL version: all versions
  • PostgREST version: all versions
  • Operating system: Linux

Description of issue

PostgREST buffers query results before returning data to client. When multiple clients request large result sets it causes peaks in memory usage and under load PostgREST process crashes with OOM errors.

Ideally PostgREST should implement zero-copy streaming of results and limit size of buffer used to move data from database to HTTP connection. The downside of streaming is that slow clients might cause db connection pool exhaustion (because db connections would be occupied during the process of copying results data). To mitigate that the buffer size limit should be configurable.