# Postgres error 53200: out of memory

> A backend could not allocate memory for the query.

Source: https://scribase.com/postgres-errors/53200

SQLSTATE class: Insufficient Resources. Over PostgREST/supabase-js this maps to HTTP 503.

## Causes

- Very large work_mem multiplied by many parallel sorts and hashes.
- Huge IN lists, giant jsonb values or array_agg over millions of rows in one statement.

## Fixes

- Process data in batches.
- Lower work_mem for the session that runs the big query, or reduce parallel workers.
- Check the plan with EXPLAIN for unexpected hash joins over large inputs.