Using AI to detect similar issues
Linear detects duplicate and related issues by embedding issue text with an LLM and running cosine similarity search. Matches appear in the issue composer, the Triage inbox and support integrations such as Intercom. After trying several dedicated vector databases, the team rejected them for scaling downtime, cost or ops burden and chose PostgreSQL with pgvector on Google Cloud. A Kubernetes-based task runner backfilled embeddings for tens of millions of issues. Unindexed queries took seconds, and indexing at that scale only worked after partitioning the embeddings table by workspace ID into several hundred partitions and indexing each one separately, following pgvector's parameter recommendations.
Related posts
- Finding relationships in your data with embeddings
incident.io mediumAdeptincident.io built a related-incidents feature by embedding a plain-text representation of each incident with OpenAI's text-embedding-ada-002 and ranking matches by cosine similarity. Prompt construction mattered most. Leaving out noisy fields such as timestamps and IDs, sorting values consistently, flattening rich text, labelling fields and replacing newlines all improved consistency, and k-means clustering was used to gauge prompt quality. In production the embeddings live in Postgres via pgvector with an HNSW index, keyed by model and prompt version so backfills can run without gaps in suggestions. In-progress incidents are re-embedded periodically once they hold enough content to give useful matches.
- Semantic search using OpenAI, pg_embedding and Neon
Neon mediumAdept
A YC idea-matcher app implements semantic search by embedding ~4,400 YCombinator company descriptions with OpenAI's text-embedding-ada-002 (1536 dimensions) and storing them as real[] columns in Neon Postgres via the pg_embedding extension. Queries embed the user's idea and order rows by cosine distance (<=>) to return the top five matches from a Next.js edge function, which is colocated with the database region and uses the Neon serverless driver, Upstash rate limiting and Zod validation. The full ingestion script and API route are shown. Sequential scan is fine for this small dataset, but larger tables need an HNSW index. pg_embedding has since been deprecated in favor of pgvector.
- Storing OpenAI embeddings in Postgres with pgvector
Supabase mediumAdeptpgvector 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. The walkthrough creates a documents table, a match_documents SQL function that filters by a cosine-similarity threshold, and an IVFFlat index sized at roughly 4 * sqrt(rows) lists. It then generates embeddings in JavaScript and builds Deno Edge Functions for semantic search and for retrieval-augmented answers with text-davinci-003, keeping injected context under about 1500 tokens to fit the 4000-token limit.
- Matryoshka embeddings: faster OpenAI vector search using Adaptive Retrieval
Supabase mediumAdeptOpenAI's text-embedding-3 models are trained with Matryoshka Representation Learning, so an embedding can be shortened by truncating trailing dimensions and renormalizing, which reproduces the API's `dimensions` output. Adaptive Retrieval exploits this with a two-pass search: a fast HNSW-indexed ANN pass on a low-dimensional prefix fetches an oversized shortlist, then exact KNN on the full 3072d vectors re-ranks it. Benchmarks on 1M dbpedia embeddings found a 512d first pass (ef_construction=400, m=32, ef_search=200, limit = top_k × 8) reached 99% accuracy against 3072d KNN at about 580 QPS. By comparison, a single pass on 1536d vectors topped out near 89%. The post finishes with a Postgres/pgvector implementation using a sub_vector SQL function.
- Building Data-Aware AI Applications with Heroku AI and LlamaIndex
Heroku Engineering mediumAdeptA RAG stack on Heroku pairs LlamaIndex for ingestion, indexing and retrieval with Heroku Managed Inference (Claude 4 Sonnet via an OpenAI-compatible API), Cohere Embed Multilingual for embeddings, and Heroku Postgres with pgvector as the vector store. The walkthrough provisions the add-ons via the Heroku CLI. It then shows Python code that points LlamaIndex's OpenAILikeEmbedding at Heroku's embedding endpoint, stores 1024-dimension vectors in PGVectorStore, and queries documents through a query engine. Example use cases include financial report analysis, insurance claim agents and support chatbots.