# gin_fuzzy_search_limit

> gin_fuzzy_search_limit is the PostgreSQL setting that defines the maximum allowed result for exact search by GIN.
---

> [!NOTE]
> **Fact — official short description:** “Sets the maximum allowed result for exact search by GIN.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `user` | Settable by an ordinary user |
| Unit | — | Raw unit |
| Range | `0` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Client Connection Defaults / Other Defaults | Upstream classification |
| Latest boot value | `0` | 0 |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0–19 Beta 3 | `0` | — | 0 |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

gin_fuzzy_search_limit sets the maximum allowed result for exact search by GIN. 0 means no limit. A positive limit makes broad GIN searches return a randomly chosen subset of matches, trading completeness for bounded work; zero preserves exact results.

gin_fuzzy_search_limit is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

GIN behavior also depends on per-index storage parameters, work or maintenance memory, autovacuum, and the shape of indexed values and predicates.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Change gin_fuzzy_search_limit only after measuring the affected GIN maintenance or search path. Prefer an index-level override when one index, rather than the whole cluster, is exceptional. |
| OLAP | For batch loads or broad searches, test gin_fuzzy_search_limit against ingestion latency, cleanup spikes, result completeness, and maintenance windows. |
| Small nodes | Do not raise gin_fuzzy_search_limit merely because the default is reached; bound memory and I/O bursts, and keep exact-query semantics unless approximation is explicitly acceptable. |
{.full-width}

## Pigsty {#pigsty}

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

| Template | Effective value | Versus upstream boot | Source expression |
| --- | --- | --- | --- |
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

## Common pitfalls {#common-pitfalls}

- Changing gin_fuzzy_search_limit in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.
- Applying a cluster-wide GIN value to fix one exceptional index instead of using its storage parameters.
- Ignoring cleanup latency, I/O bursts, autovacuum interaction, or result completeness while tuning.
- Enabling a positive limit without telling callers that exact searches may return an incomplete random subset.

## Related parameters {#related-parameters}

[`gin_pending_list_limit`](/parameters/gin-pending-list-limit/) · [`maintenance_work_mem`](/parameters/maintenance-work-mem/) · [`work_mem`](/parameters/work-mem/) · [`vacuum_cleanup_index_scale_factor`](/parameters/vacuum-cleanup-index-scale-factor/) · [`autovacuum_work_mem`](/parameters/autovacuum-work-mem/)

## References {#references}

- [PostgreSQL 19 Beta 3 — gin_fuzzy_search_limit](https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-GIN-FUZZY-SEARCH-LIMIT)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
