---
title: "Using AI to detect similar issues"
description: "Linear detects duplicate and related issues by embedding issue text with an LLM and running cosine similarity search."
url: "https://swe.quest/articles/using-ai-to-detect-similar-issues-df2d1445fbbe6dc8"
canonical: "https://linear.app/now/using-ai-to-detect-similar-issues"
source: "Linear"
published: "2023-11-29"
difficulty: "medium"
kind: "Case study"
reading_minutes: 5
tags: ["vector-search","postgres","search","llms","product-engineering"]
---

# Using AI to detect similar issues

A post on [Linear](https://swe.quest/sources/linear.md), published 2023-11-29, 5 min read, Case study. Original: [https://linear.app/now/using-ai-to-detect-similar-issues](https://linear.app/now/using-ai-to-detect-similar-issues)

## Summary

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.

Written by swe.quest, not by the author.

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

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Product engineering](https://swe.quest/tags/product-engineering.md) (Engineering organization)

## Prerequisites

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

## Keywords

Linear, pgvector, PostgreSQL, Google Cloud, Intercom, Elasticsearch

## Related posts

- [Finding relationships in your data with embeddings](https://swe.quest/articles/finding-relationships-in-your-data-with-embeddings-269cb25fce48621d.md): incident.io · 2024-01-19 · Medium · 14 min read · Vector search, PostgreSQL, LLMs, Product engineering, Incidents & postmortems
  incident.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.
- [Semantic search using OpenAI, pg\_embedding and Neon](https://swe.quest/articles/semantic-search-using-openai-pg-embedding-and-neon-aeafbc27d93ca728.md): Neon · 2023-08-25 · Medium · 9 min read · Vector search, PostgreSQL, LLMs, Serverless, TypeScript
  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.
- [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.
- [Matryoshka embeddings: faster OpenAI vector search using Adaptive Retrieval](https://swe.quest/articles/matryoshka-embeddings-faster-openai-vector-search-using-adaptive-retrieval-739d1a8595798695.md): Supabase · 2024-02-13 · Medium · 17 min read · Vector search, PostgreSQL, RAG & retrieval, Performance engineering
  OpenAI'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.
- [Building Data-Aware AI Applications with Heroku AI and LlamaIndex](https://swe.quest/articles/building-data-aware-ai-applications-with-heroku-ai-and-llamaindex-8f85403b0aabecc2.md): Heroku Engineering · 2025-08-19 · Medium · 4 min read · RAG & retrieval, Vector search, PostgreSQL, Python, LLMs
  A 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.

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)
