Prompt

I'm building search on top of Postgres — what stack should I use?

Technology / Search & Discovery Tools1 observationLast seen Oct 12, 2026

Latest observation

Oct 12, 2026OpenAI APIWeb search: off

It depends on what “search” means for your app, but if you’re building on top of Postgres, the usual best answer is:

Good default stack

  • Postgres as the source of truth
  • Postgres Full-Text Search for basic text search
  • pg_trgm for fuzzy matching / typo tolerance
  • A small search service layer in your app for ranking, filtering, and query building
  • Redis only if you need caching or fast autocomplete suggestions
  • OpenSearch/Elasticsearch only if your search needs grow beyond what Postgres can comfortably handle

When Postgres is enough

Use Postgres search if you need:

  • keyword search
  • filtering by structured fields
  • moderate scale
  • simple relevance ranking
  • search tightly coupled with transactional data

Typical features:

  • tsvector / tsquery
  • GIN indexes
  • pg_trgm for %term%-style matching and fuzzy search
  • optional materialized views or generated columns for precomputed search vectors

This is the best starting point for most apps.

When to add a dedicated search engine

Consider OpenSearch/Elasticsearch if you need:

  • advanced relevance tuning
  • faceting/aggregations at large scale
  • complex synonyms, stemming, language analysis
  • autocomplete at very high QPS
  • huge datasets with heavy read load
  • near-real-time indexing/search at scale

Recommended architecture

Simple version

  • App writes to Postgres
  • Search queries hit Postgres directly
  • Use:
    • tsvector columns
    • GIN index
    • pg_trgm on searchable text fields

Scalable version

  • Postgres is primary DB
  • CDC or background jobs sync data to search index
  • Search layer (Postgres or OpenSearch) powers queries
  • App talks to a search API, not directly to SQL

Practical stack recommendation by stage

MVP / early stage

  • Postgres + tsvector + pg_trgm
  • Query builder in your app
  • Redis for caching if needed

Growth stage

  • Postgres search still primary
  • Add background indexing jobs
  • Add autocomplete with Redis or a materialized suggestions table

Large scale / complex relevance

  • Postgres as source of truth
  • OpenSearch for search
  • CDC via Debezium / logical replication / app events

My opinionated recommendation

Start with:

  • Postgres FTS
  • pg_trgm
  • GIN indexes
  • application-side ranking/filters
  • background indexing jobs

Only move to Elasticsearch/OpenSearch when you can clearly name the limitation you’ve hit.

If you want, I can also give you:

  1. a concrete Postgres schema + index setup,
  2. a recommendation by use case (product search, docs search, people search, etc.), or
  3. a decision tree for Postgres vs OpenSearch.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.