---
title: "Automatic Embeddings in Postgres"
description: "Supabase moves embedding generation coordination into Postgres."
url: "https://swe.quest/articles/automatic-embeddings-in-postgres-41612b12257af4ee"
canonical: "https://supabase.com/blog/automatic-embeddings"
source: "Supabase"
published: "2025-04-01"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 6
tags: ["postgres","vector-search","rag","messaging"]
---

# Automatic Embeddings in Postgres

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2025-04-01, 6 min read, Announcement. Original: [https://supabase.com/blog/automatic-embeddings](https://supabase.com/blog/automatic-embeddings)

## Summary

Supabase moves embedding generation coordination into Postgres. Insert and update triggers enqueue jobs in pgmq, pg\_cron batches them, and pg\_net calls an Edge Function that hits an embedding API, then writes results into a pgvector column. The design avoids drift between content and vectors and keeps slow inference off the write path. Embeddings are briefly null after a write until the async job completes. A generated-column approach is rejected because it blocks writes unless the model is local and fast.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [Queues & messaging](https://swe.quest/tags/messaging.md) (Backend & APIs)

## Prerequisites

- Postgres triggers ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- vector embeddings basics ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))

## Keywords

Supabase, pgvector, pgmq, pg\_cron, pg\_net, Supabase Edge Functions, OpenAI embeddings, HNSW

## Related posts

- [Storing OpenAI embeddings in Postgres with pgvector](https://swe.quest/articles/storing-openai-embeddings-in-postgres-with-pgvector-19a5d03614f86fc6.md): Supabase · 2023-02-06 · Medium · 11 min read · Vector search, PostgreSQL, RAG & retrieval, LLMs
  pgvector adds a vector data type and distance operators (Euclidean \<-\>, negative inner product \<#\>, cosine \<=\>) to Postgres, so OpenAI text-embedding-ada-002 embeddings (1536 dimensions) can be stored and queried for similarity directly in the database.
- [Hugging Face is now supported in Supabase](https://swe.quest/articles/hugging-face-is-now-supported-in-supabase-b922ce506c4fa31d.md): Supabase · 2023-08-07 · Medium · 7 min read · Vector search, PostgreSQL, Serverless, Python, JavaScript
  Supabase adds first-class Hugging Face support for generating embeddings stored in pgvector, as an open-source, self-hostable alternative to OpenAI's text-embedding-ada-002.
- [Introducing Vector Buckets](https://swe.quest/articles/introducing-vector-buckets-dbf3248011e75bdf.md): Supabase · 2025-12-01 · Medium · 7 min read · Vector search, PostgreSQL, Storage systems
  Supabase Vector Buckets are a new Storage bucket type that keeps embeddings in S3-backed object storage with built-in k-NN similarity search, supporting up to 50M vectors per index, cosine distance and metadata filtering.
- [ChatGPT plugins now support Postgres & Supabase](https://swe.quest/articles/chatgpt-plugins-now-support-postgres-supabase-db9d10a95a8d96b9.md): Supabase · 2023-05-25 · Medium · 7 min read · RAG & retrieval, Vector search, PostgreSQL, LLMs
  Supabase contributed Postgres and Supabase datastore providers to OpenAI's ChatGPT Retrieval Plugin, storing text-embedding-ada-002 embeddings in pgvector.
- [AI Inference now available in Supabase Edge Functions](https://swe.quest/articles/ai-inference-now-available-in-supabase-edge-functions-9d09d3bcda534938.md): Supabase · 2024-04-16 · Medium · 5 min read · Serverless, Inference & serving, Vector search, LLMs
  Supabase Edge Functions gain a built-in Supabase.ai.Session API for running AI inference in a few lines of code, starting with gte-small embeddings for storage in pgvector and experimental, invite-only Llama and Mistral LLMs with streaming responses.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
