Define a table schema with vector and metadata columns.
Load embedding vectors and associated product metadata.
Configure a Hierarchical Navigable Small World (HNSW) index on the embedding vector columns.
Perform a similarity search using a WHERE clause and the < = > operator.
The workflow must first establish a PostgreSQL schema containing both the pgvector embedding column and the product metadata required for filtering. The embeddings and their associated metadata are then bulk-loaded. This ordering is important because Microsoft recommends loading data before creating vector indexes ; creating the index afterward provides faster ingestion and a more optimal index layout.
After loading, configure an HNSW index on the embedding column. HNSW is an approximate-nearest-neighbor index supported by pgvector and provides a strong speed/recall tradeoff for low-latency vector retrieval. Microsoft specifically documents HNSW for efficient cosine-distance searches in Azure Database for PostgreSQL.
Finally, execute the retrieval query so that mandatory product metadata constraints are applied through a WHERE clause , while vector similarity is evaluated with the < = > cosine-distance operator . This satisfies Fabrikam ' s requirement to calculate similarity only for eligible products.
A B-tree index is not an ANN vector index, and increasing Redis memory does not implement PostgreSQL semantic retrieval.
Study Guide references: Azure Database for PostgreSQL → pgvector, HNSW indexing, bulk-load optimization, vector similarity operators, metadata-filtered retrieval.