Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix: embedding match query in blog post to correctly utilize index (#19136)

Greg Richardsonf99e82f5bf18
diff --git a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
index 7184cd66f41..3a1e8a3ebec 100644
--- a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
+++ b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
@@ -128,8 +128,8 @@ as $$
documents.content,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
- where 1 - (documents.embedding <=> query_embedding) > match_threshold
- order by similarity desc
+ where documents.embedding <=> query_embedding < 1 - match_threshold
+ order by documents.embedding <=> query_embedding
limit match_count;
$$;
```