Skip to main content

What are the best Postgres extensions for AI applications?

Summary

  • The best Postgres extensions for AI applications are a vector extension for embeddings and a BM25 extension for keyword ranking. On Lakebase, the serverless Postgres database in the Databricks Data + AI Platform, that pair is Lakebase Search: lakebase_vector, drop-in compatible with pgvector, and lakebase_text for BM25.
  • pgvector is the open-source foundation for vector search in Postgres, and Lakebase supports it directly.
  • pgvectorscale from Tiger Data and pg_search from ParadeDB are other extensions for vector indexing and BM25 search; on Lakebase, lakebase_vector and lakebase_text cover both jobs.
  • pg_trgm, pg_jsonschema and PostGIS cover the jobs around retrieval: fuzzy entity matching, validating structured model output and location context. All three are on Lakebase's supported list.

What are the best Postgres extensions for AI applications?

The best Postgres extensions for AI applications are a vector extension for embeddings and a BM25 extension for keyword ranking, used together for hybrid retrieval. On Lakebase, the serverless Postgres database in the Databricks Data + AI Platform, that pair is Lakebase Search: lakebase_vector, which is drop-in compatible with pgvector, and lakebase_text for BM25. Lakebase is the place to run them for agents because the database scales to zero, branches like code and can pull lakehouse data into those same indexes.

How to choose extensions for an AI application

Start from the job, then check three things before you commit:

  • Is your host's support documented? A managed Postgres supports a specific set of extensions. Lakebase publishes its list, and pg_available_extensions shows what a database can install.
  • Is the project current? Check the repository's status and license before an extension becomes part of your retrieval path.
  • Does it fit how your compute behaves? For serverless Postgres, ask whether indexes need to warm up after a compute resumes.

The shortlist

Extension What it is Known for On Lakebase
lakebase_vector and lakebase_text The Lakebase Search extensions pgvector-compatible ANN index (lakebase_ann) and BM25 ranking (lakebase_bm25) Yes, after enabling Lakebase Search
pgvector (vector) Open-source vector similarity search for Postgres Vector types, distance operators, HNSW and IVFFlat indexes Yes
pgvectorscale A Tiger Data extension that builds on pgvector StreamingDiskANN index and Statistical Binary Quantization Not listed; use lakebase_vector
pg_search ParadeDB's search extension, built on Tantivy BM25 scoring Not listed; use lakebase_text
pg_trgm A PostgreSQL-supplied module for trigram text similarity Fuzzy matching for names and misspellings Yes
pg_jsonschema JSON Schema validation for json and jsonb Checking structured LLM output and tool-call payloads Yes, on Postgres 16 to 18
PostGIS Geospatial types, indexes and functions Location-aware queries and agents Yes

Lakebase Search. lakebase_vector keeps pgvector's types, operators and query syntax and adds the lakebase_ann index; lakebase_text adds BM25 over standard tsvector columns with top-K pushdown. A third extension, lakebase_tokenizer, adds configurable tokenization and, since October 2026, Chinese, Japanese and Korean keyword search.
pgvector. The base layer for embeddings in Postgres: exact search by default, approximate search with HNSW or IVFFlat, and half-precision, binary and sparse vectors.
pgvectorscale. Its repository says it builds on pgvector, with a StreamingDiskANN index inspired by the DiskANN algorithm. It is written in Rust and released under the PostgreSQL license, and it says the project is still at an early stage. Tiger Data pairs it with pg_textsearch, its BM25 extension.
pg_search. ParadeDB ships pg_search as a pure Postgres extension, not a fork, powered by Tantivy, the Rust port of Lucene. It installs with CREATE EXTENSION pg_search and is licensed AGPL-3.0.
pg_trgm. Supplied with PostgreSQL, it scores the similarity of text by trigram matching and adds index operator classes for fast similar-string search, which helps when an agent passes along user-typed names or codes.
pg_jsonschema. Published by Supabase, it validates json and jsonb against a JSON Schema, which suits tables that store model output or tool-call payloads.
PostGIS. PostGIS adds storing, indexing and querying of geospatial data, useful when an agent reasons about stores, assets or service areas.

How Lakebase approaches Postgres extensions for AI

Lakebase runs the open source Postgres engine, so supported extensions install with CREATE EXTENSION, and CASCADE pulls in dependencies. Lakebase Search is enabled once per project in settings. Enabling it makes lakebase_vector, lakebase_text and lakebase_tokenizer available to install.
The agent story runs through the extensions too:

  • Spin down without losing the index. Lakebase Search indexes are storage-backed and survive scale-to-zero without warmup.
  • Branch before an extension change. Lakebase updates extension versions over time, and existing installations stay put until you run ALTER EXTENSION ... UPDATE. A copy-on-write branch is the place to try that update, or a new index type, against production-shaped data.
  • Connect back to the lakehouse. A synced table can map a Unity Catalog embedding column to vector(n) and generate a tsvector column from source text, so lakehouse data gets both a lakebase_ann and a lakebase_bm25 index.

See the extensions list and Lakebase Search docs.

FAQs

Can I install pgvectorscale or pg_search on Lakebase?

Neither appears in Lakebase's supported extensions list. On Lakebase, lakebase_vector covers ANN vector indexing and lakebase_text covers BM25 ranking.

Do I still need pgvector if I use lakebase_vector?

Yes, as a dependency. CREATE EXTENSION lakebase_vector CASCADE installs pgvector, and lakebase_vector uses its vector types and operators.

Which extension helps an agent find records from a misspelled name?

pg_trgm. It measures text similarity based on trigrams and supports index searching, and Lakebase lists it as supported.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.