pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: anuj-kukunarapu (@anuj-kukunarapu) <noreply+anuj-kukunarapu@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #980: Feature Request: Filtered HNSW / Segment-Level Indexes for Efficient Metadata Filtering
Date: Wed, 29 Apr 2026 10:02:25 +0000
Message-ID: <gh-pgvector-pgvector-980@github.com> (raw)

### Description

Many modern vector databases support efficient vector search with metadata filters by making approximate nearest neighbor (ANN) search aware of filter predicates. Examples include approaches such as filtered HNSW, segment-level indexes, or per-partition/per-tenant vector indexes.

These approaches allow queries with filters such as `asset_id`, `tenant_id`, `category_id`, or `collection_id` to search only the relevant subset or subgraph, instead of traversing a single global vector graph and filtering results afterward.

### Current Behavior in pgvector

pgvector currently supports HNSW and IVFFlat approximate indexes. PostgreSQL users can work around filtered-search scenarios using approaches such as:

- B-tree, GIN, or other exact indexes on filter columns
- Partial HNSW indexes for a small number of filter values
- Table partitioning for partition-based isolation
- Tuning `hnsw.ef_search`
- Iterative index scans introduced in pgvector 0.8.0

However, when using a normal global HNSW index, metadata predicates are applied after the ANN index scan. This means the HNSW traversal itself is not restricted to rows that match the filter condition.

For example:

```sql
SELECT *
FROM items
WHERE tenant_id = $1
ORDER BY embedding <-> $2
LIMIT 10;
``

view thread (4+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-980@github.com>
Permalink:  ../gh-pgvector-pgvector-980@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox