// troubleshooting guide · pgvector

pgvector Index Not Being Used

Status
Fixed in latest version
platforms:
All
updated:
November 15, 2026
reports:
4
Method
how we research
Share

RUNBOOK · pgvector/index-not-used3 FIXES

// quick answer

The planner uses the index only for ORDER BY on a distance operator, ascending, with LIMIT, and a matching operator class.

Most likely fix: Fix the query shape

How to fix it

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

  1. FIX 1Fix the query shape

    1. 01Use ORDER BY embedding <=> $1 LIMIT k directly on the table
    2. 02Avoid ORDER BY 1 - (embedding <=> ...) DESC
    Did this fix it?
  2. FIX 2Match operator class

    1. 01Cosine needs vector_cosine_ops, L2 vector_l2_ops, inner product vector_ip_ops
    Did this fix it?
  3. FIX 3Diagnose

    1. 01Run EXPLAIN (ANALYZE, BUFFERS)
    2. 02Run ANALYZE on the table
    3. 03In a transaction try SET LOCAL enable_seqscan = off to see if cost is the issue
    Did this fix it?

Symptoms

EXPLAIN shows Seq Scan instead of an index scan.

Why it happens

  • C-01Wrapped or descending ORDER BY
  • C-02Distance computed in a subquery and sorted on alias
  • C-03Operator class mismatch
  • C-04Small table or stale stats

// this guide also covers

  • pgvector index not used
  • pgvector sequential scan
  • pgvector explain analyze seq scan

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

Other pgvector errors

All 11 pgvector errors and fixes →