<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn" -->

---
title: When pgvector Starts to Slow Down as Your Vector Table Grows
description: Explains why pgvector&#x27;s query latency stays flat as a vector table grows, then jumps sharply once the HNSW graph no longer fits in memory or IVFFlat clusters...
canonical: https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: When pgvector Starts to Slow Down as Your Vector Table Grows | daily.dev
og:description: Explains why pgvector&#x27;s query latency stays flat as a vector table grows, then jumps sharply once the HNSW graph no longer fits in memory or IVFFlat clusters...
og:url: https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn
og:image: https://api.daily.dev/og/posts/b5jeoOVPn.png
og:image:alt: When pgvector Starts to Slow Down as Your Vector Table Grows
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# When pgvector Starts to Slow Down as Your Vector Table Grows

**[DigitalOcean Community](https://daily.dev/sources/do_community)** · 11 min read · 0 upvotes · 0 comments

## Summary

Explains why pgvector's query latency stays flat as a vector table grows, then jumps sharply once the HNSW graph no longer fits in memory or IVFFlat clusters become uneven. Covers the mechanics of embeddings, HNSW vs IVFFlat indexing, distance operators, and SQL syntax for setup. Recommends running your own benchmarks at increasing table sizes rather than relying on published numbers, and mentions pgvectorscale as an option to push the threshold further before needing a dedicated vector database. Includes DigitalOcean-specific setup notes for its Managed PostgreSQL offering.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.digitalocean.com/community/tutorials/pgvector-at-scale-article>

## Questions this post answers

### Why does pgvector query latency suddenly spike instead of increasing gradually as the table grows?

Latency stays flat until the HNSW index's graph no longer fits in RAM, at which point Postgres must pull graph pieces from disk, causing a sharp jump rather than gradual decline. HNSW keeps its entire graph in memory while in use, so performance is predictable until that memory ceiling is crossed, then disk reads add significant overhead.

_Anyone tuning vector search at scale can track pgvector performance patterns like this on daily.dev._

### Should I use HNSW or IVFFlat for my pgvector index in Postgres?

HNSW is recommended as the default for most small-to-medium workloads because it offers better recall, while IVFFlat is reserved for cases where build time or memory usage matters more than recall. IVFFlat also degrades unevenly since real-world embeddings cluster unevenly, causing random latency spikes rather than steady slowdown.

_Developers choosing between vector index types can compare tradeoffs like these on daily.dev._

### Why does CREATE EXTENSION pgvector fail in PostgreSQL?

The command fails because although the project is named pgvector, the extension registers under the name vector, so the correct command is CREATE EXTENSION IF NOT EXISTS vector. Extensions are also scoped per database rather than per cluster, meaning pgvector must be enabled separately in every database that will store vectors.

_Teams setting up pgvector on managed Postgres can avoid setup snags like this via daily.dev._

## Similar posts on daily.dev

- [The reason your pgvector benchmark is lying to you](https://daily.dev/posts/the-reason-your-pgvector-benchmark-is-lying-to-you-deuqnlu3d) · The New Stack · 0 upvotes · 0 comments
- [The Case Against pgvector](https://daily.dev/posts/the-case-against-pgvector-amqbtam6f) · Hacker News · 3 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql), [#rag](https://daily.dev/tags/rag), [#vector-search](https://daily.dev/tags/vector-search), [#pgvector](https://daily.dev/tags/pgvector)

[View this post on daily.dev](https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"When pgvector Starts to Slow Down as Your Vector Table Grows","url":"https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn"},"datePublished":"2026-08-31T20:15:58.933Z","dateModified":"2026-08-31T20:27:48.315Z","description":"Explains why pgvector's query latency stays flat as a vector table grows, then jumps sharply once the HNSW graph no longer fits in memory or IVFFlat clusters...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8f2172bba436e9bce87684915dfd91c6?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8f2172bba436e9bce87684915dfd91c6?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"DigitalOcean Community","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DigitalOcean Community","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/c1b9d07730e34ea388c39a498a753d6c","url":"https://daily.dev/sources/do_community"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,postgresql,rag,vector-search,pgvector","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DigitalOcean Community","item":"https://daily.dev/sources/do_community"},{"@type":"ListItem","position":3,"name":"When pgvector Starts to Slow Down as Your Vector Table Grows"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/when-pgvector-starts-to-slow-down-as-your-vector-table-grows-b5jeoovpn#faq","mainEntity":[{"@type":"Question","name":"Why does pgvector query latency suddenly spike instead of increasing gradually as the table grows?","acceptedAnswer":{"@type":"Answer","text":"Latency stays flat until the HNSW index's graph no longer fits in RAM, at which point Postgres must pull graph pieces from disk, causing a sharp jump rather than gradual decline. HNSW keeps its entire graph in memory while in use, so performance is predictable until that memory ceiling is crossed, then disk reads add significant overhead. Anyone tuning vector search at scale can track pgvector performance patterns like this on daily.dev."}},{"@type":"Question","name":"Should I use HNSW or IVFFlat for my pgvector index in Postgres?","acceptedAnswer":{"@type":"Answer","text":"HNSW is recommended as the default for most small-to-medium workloads because it offers better recall, while IVFFlat is reserved for cases where build time or memory usage matters more than recall. IVFFlat also degrades unevenly since real-world embeddings cluster unevenly, causing random latency spikes rather than steady slowdown. Developers choosing between vector index types can compare tradeoffs like these on daily.dev."}},{"@type":"Question","name":"Why does CREATE EXTENSION pgvector fail in PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"The command fails because although the project is named pgvector, the extension registers under the name vector, so the correct command is CREATE EXTENSION IF NOT EXISTS vector. Extensions are also scoped per database rather than per cluster, meaning pgvector must be enabled separately in every database that will store vectors. Teams setting up pgvector on managed Postgres can avoid setup snags like this via daily.dev."}}]}
```

