// troubleshooting guide · pgvector

pgvector HNSW Build Out of Memory or Shared Memory Error

Status
Workaround available
platforms:
Docker, Cloud SQL, self-hosted
updated:
November 15, 2026
reports:
3
Method
how we research
Share

RUNBOOK · pgvector/hnsw-build-out-of-memory3 FIXES

// quick answer

Parallel HNSW builds need shared memory and RAM. Increase Docker shm_size, lower workers or memory settings.

Most likely fix: Docker shared memory

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Docker shared memory

    1. 01Set shm_size in docker-compose to at least maintenance_work_mem
    Did this fix it?
  2. FIX 2Reduce settings

    1. 01Lower max_parallel_maintenance_workers
    2. 02Lower maintenance_work_mem
    Did this fix it?
  3. FIX 3Check for OOM kills

    1. 01Run dmesg and look for OOM killer lines
    2. 02Move to a larger instance
    Did this fix it?

Symptoms

Build aborts with could not resize shared memory segment or the process is OOM killed.

Why it happens

  • C-01Docker /dev/shm default of 64 MB
  • C-02maintenance_work_mem larger than available RAM
  • C-03Too many parallel workers

// this guide also covers

  • pgvector could not resize shared memory segment
  • pgvector out of memory
  • hnsw index build fails

Still not working?

If pgvector keeps failing, you're not alone. See every pgvector problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch pgvector Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All export, render & quality loss guides →

Other pgvector errors

All 11 pgvector errors and fixes →