<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr" -->

---
title: All Your GUCs in a Row: gin_fuzzy_search_limit | daily.dev
description: PostgreSQL's `gin_fuzzy_search_limit` GUC parameter instructs GIN index scans to silently return a random subset of matching rows rather than the full result...
canonical: https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: All Your GUCs in a Row: gin_fuzzy_search_limit | daily.dev
og:description: PostgreSQL's `gin_fuzzy_search_limit` GUC parameter instructs GIN index scans to silently return a random subset of matching rows rather than the full result...
og:url: https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr
og:image: https://api.daily.dev/og/posts/JW9vFI5nr.png
og:image:alt: All Your GUCs in a Row: gin_fuzzy_search_limit
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.

# All Your GUCs in a Row: gin_fuzzy_search_limit

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 6 min read · 1 upvotes · 2 comments

## Summary

PostgreSQL's `gin_fuzzy_search_limit` GUC parameter instructs GIN index scans to silently return a random subset of matching rows rather than the full result set. Originally designed for full-text search over large corpora where approximate relevance ranking is acceptable, it has become a hazard because GIN now backs jsonb, array, hstore, and trigram searches where callers expect complete results. Aggregations like COUNT, SUM, and EXISTS silently return wrong answers with no warning or EXPLAIN indication. The recommendation is to leave it at 0 and instead improve query selectivity, filter candidate sets explicitly, or use the RUM index for relevance-ranked large result sets. If the original use case genuinely applies, set it per session only, never in postgresql.conf.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9qw>

## Questions this post answers

### What does PostgreSQL's gin_fuzzy_search_limit parameter actually do?

It instructs PostgreSQL's GIN index scans to return a random subset of matching rows instead of the complete result set, without any warning or indication in query output. The number returned is approximate, called 'soft', because it can vary between identical executions depending on the query and the system's random number generator. It defaults to 0, meaning no limit, and is an integer valid up to 2147483647.

_Anyone tuning PostgreSQL query correctness and performance can track gotchas like this one on daily.dev._

### Why is it dangerous to set gin_fuzzy_search_limit in postgresql.conf?

Setting it globally applies the random row-dropping behavior to every GIN index scan in the database, not just the full-text search query it was designed for, including jsonb containment, array containment, hstore, and pg_trgm similarity lookups. The most severe risk is aggregation: a COUNT, SUM, AVG, or EXISTS over a GIN scan silently returns an approximate number near the fuzzy limit with no error or EXPLAIN indication that it's a sample.

_Developers debugging unexplained data discrepancies in PostgreSQL can find deep dives like this via daily.dev._

### What is a better alternative to gin_fuzzy_search_limit for ranking large full-text search results?

Use the RUM index from Postgres Professional, which stores ranking information inside the index itself so ordered retrieval doesn't require fetching and sorting every matching row from the heap first. Other honest alternatives include making the query more selective with websearch_to_tsquery or stopword configuration, or filtering the candidate set by a date range, category, or owner before ranking.

_Teams choosing between PostgreSQL indexing strategies can compare approaches like this through daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@trevorsuna** · 0 upvotes

> This is one of those settings that sounds useful until COUNT starts lying to you. Keeping it at 0 by default and enabling it only per session feels like the sane move.

## Similar posts on daily.dev

- [All Your GUCs in a Row: from\_collapse\_limit](https://daily.dev/posts/all-your-gucs-in-a-row-from-collapse-limit-r62ismyyi) · Planet PostgreSQL · 0 upvotes · 0 comments
- [All Your GUCs in a Row: join\_collapse\_limit](https://daily.dev/posts/all-your-gucs-in-a-row-join-collapse-limit-rykvggydx) · Planet PostgreSQL · 1 upvotes · 1 comments
- [All Your GUCs in a Row: cursor\_tuple\_fraction](https://daily.dev/posts/all-your-gucs-in-a-row-cursor-tuple-fraction-3ucl8qhmc) · Planet PostgreSQL · 0 upvotes · 0 comments
- [All Your GUCs in a Row: enable\_incremental\_sort](https://daily.dev/posts/all-your-gucs-in-a-row-enable-incremental-sort-xf4skwqco) · Planet PostgreSQL · 0 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr)

```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":"All Your GUCs in a Row: gin_fuzzy_search_limit","url":"https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr"},"datePublished":"2026-07-27T01:01:11.583Z","dateModified":"2026-09-13T20:18:42.515Z","description":"PostgreSQL's `gin_fuzzy_search_limit` GUC parameter instructs GIN index scans to silently return a random subset of matching rows rather than the full result...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/24a93a64ad7f867d3265f204533c530f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/24a93a64ad7f867d3265f204533c530f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet PostgreSQL","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":"Planet PostgreSQL","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/planet-postgresql"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"postgresql,full-text-search","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet PostgreSQL","item":"https://daily.dev/sources/planet-postgresql"},{"@type":"ListItem","position":3,"name":"All Your GUCs in a Row: gin_fuzzy_search_limit"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr","comment":[{"@type":"Comment","text":"This is one of those settings that sounds useful until COUNT starts lying to you. Keeping it at 0 by default and enabling it only per session feels like the sane move.","datePublished":"2026-07-27T01:39:12.062Z","url":"https://daily.dev/posts/JW9vFI5nr#c-MPS2JctYQ","author":{"@type":"Person","name":"Trevor Suna","url":"https://daily.dev/trevorsuna","image":"https://media.daily.dev/image/upload/s--dZ7gXxpp--/f_auto/v1784081551/avatars/avatar_EMoP47rpuw8DNjhp6R1b6?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/all-your-gucs-in-a-row-gin-fuzzy-search-limit-jw9vfi5nr#faq","mainEntity":[{"@type":"Question","name":"What does PostgreSQL's gin_fuzzy_search_limit parameter actually do?","acceptedAnswer":{"@type":"Answer","text":"It instructs PostgreSQL's GIN index scans to return a random subset of matching rows instead of the complete result set, without any warning or indication in query output. The number returned is approximate, called 'soft', because it can vary between identical executions depending on the query and the system's random number generator. It defaults to 0, meaning no limit, and is an integer valid up to 2147483647. Anyone tuning PostgreSQL query correctness and performance can track gotchas like this one on daily.dev."}},{"@type":"Question","name":"Why is it dangerous to set gin_fuzzy_search_limit in postgresql.conf?","acceptedAnswer":{"@type":"Answer","text":"Setting it globally applies the random row-dropping behavior to every GIN index scan in the database, not just the full-text search query it was designed for, including jsonb containment, array containment, hstore, and pg_trgm similarity lookups. The most severe risk is aggregation: a COUNT, SUM, AVG, or EXISTS over a GIN scan silently returns an approximate number near the fuzzy limit with no error or EXPLAIN indication that it's a sample. Developers debugging unexplained data discrepancies in PostgreSQL can find deep dives like this via daily.dev."}},{"@type":"Question","name":"What is a better alternative to gin_fuzzy_search_limit for ranking large full-text search results?","acceptedAnswer":{"@type":"Answer","text":"Use the RUM index from Postgres Professional, which stores ranking information inside the index itself so ordered retrieval doesn't require fetching and sorting every matching row from the heap first. Other honest alternatives include making the query more selective with websearch_to_tsquery or stopword configuration, or filtering the candidate set by a date range, category, or owner before ranking. Teams choosing between PostgreSQL indexing strategies can compare approaches like this through daily.dev."}}]}
```

