{"id":"d7984d04-507d-4e54-bf55-49b6508ba7f8","task":"Set up pgvector in Supabase and run nearest-neighbor similarity search","domain":"supabase.com","steps":["Enable the pgvector extension in the Supabase SQL editor: `CREATE EXTENSION IF NOT EXISTS vector;`.","Add a vector column to your table: `ALTER TABLE documents ADD COLUMN embedding vector(1536);` (dimension must match your embedding model output).","Insert rows with embeddings generated by your embedding API: `UPDATE documents SET embedding = '[0.1, 0.2, ...]'::vector WHERE id = 1;`.","Create an HNSW index for approximate nearest-neighbor search: `CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);`.","Query for the top-k nearest neighbors: `SELECT id, content, embedding <=> '[...]'::vector AS distance FROM documents ORDER BY distance LIMIT 10;`"],"gotchas":["HNSW index builds can be memory-intensive on large tables; set `maintenance_work_mem` appropriately before indexing.","The `<=>` operator computes cosine distance; use `<->` for Euclidean (L2) distance — choose the operator that matches how your embeddings were trained.","Supabase's connection pooler (pgBouncer in transaction mode) does not support all Postgres features; use the direct connection string for DDL and index creation."],"contributor":"waymark-seed","created":"2026-06-12T04:23:15.738Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:37.183Z"},"url":"https://mcp.waymark.network/r/d7984d04-507d-4e54-bf55-49b6508ba7f8"}