<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf" -->

---
title: Speeding Up PostgreSQL Full-Text Search with Persistent...
description: PostgreSQL full-text search can become slow at scale when tsvectors are computed on-the-fly during queries. By persisting tsvectors in a dedicated column with...
canonical: https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Speeding Up PostgreSQL Full-Text Search with Persistent TSVectors | daily.dev
og:description: PostgreSQL full-text search can become slow at scale when tsvectors are computed on-the-fly during queries. By persisting tsvectors in a dedicated column with...
og:url: https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf
og:image: https://api.daily.dev/og/posts/BqHVMF0uF.png
og:image:alt: Speeding Up PostgreSQL Full-Text Search with Persistent TSVectors
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.

# Speeding Up PostgreSQL Full-Text Search with Persistent TSVectors

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 14 min read · 0 upvotes · 0 comments

## Summary

PostgreSQL full-text search can become slow at scale when tsvectors are computed on-the-fly during queries. By persisting tsvectors in a dedicated column with a GIN index, query performance improved 118× (from ~283ms to ~2.4ms) on 100k rows. The optimization shifts PostgreSQL from sequential scans to bitmap index scans, reducing work from processing all rows to only matching ones. Implementation involves adding a tsvector column, creating a GIN index concurrently, setting up a database trigger for automatic updates, and configuring pg_search to use the persisted column instead of computing vectors at query time.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://danielabaron.me/blog/speed-up-pg-fts-with-persistent-ts-vectors/>

## Similar posts on daily.dev

- [Do you really need tsvector column? – select \* from depesz;](https://daily.dev/posts/do-you-really-need-tsvector-column-select-from-depesz--iz5rkmaat) · depesz · 0 upvotes · 0 comments
- [Building Vector Similarity Search in PostgreSQL with pgvector](https://daily.dev/posts/building-vector-similarity-search-in-postgresql-with-pgvector-klkt5sztv) · Machine Learning Mastery · 0 upvotes · 0 comments
- [The Case Against pgvector](https://daily.dev/posts/the-case-against-pgvector-amqbtam6f) · Hacker News · 3 upvotes · 0 comments
- [Postgres Full-Text Search Instead of Elasticsearch](https://daily.dev/posts/postgres-full-text-search-instead-of-elasticsearch-85slaibvz) · Prisma Blog · 0 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql), [#rails](https://daily.dev/tags/rails), [#full-text-search](https://daily.dev/tags/full-text-search)

[View this post on daily.dev](https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf)

```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":"Speeding Up PostgreSQL Full-Text Search with Persistent TSVectors","url":"https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf"},"datePublished":"2026-02-03T22:30:43.976Z","dateModified":"2026-02-03T22:31:27.373Z","description":"PostgreSQL full-text search can become slow at scale when tsvectors are computed on-the-fly during queries. By persisting tsvectors in a dedicated column with...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/988e239ed7746e5bcb6e9d58443bd430?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/988e239ed7746e5bcb6e9d58443bd430?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"RUBYLAND","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":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/speeding-up-postgresql-full-text-search-with-persistent-tsvectors-bqhvmf0uf","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,postgresql,rails,full-text-search","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"Speeding Up PostgreSQL Full-Text Search with Persistent TSVectors"}]}
```

