Parameter · Client Connection Defaults / Other Defaults
gin_fuzzy_search_limit
Sets the maximum allowed result for exact search by GIN. 0 means no limit.
- Default:
0 - Type: integer
- Range: 0 … 2147483647
- Applies: Session (any user)
In plain words
An old trick for full-text search over huge data: if a search term matches millions of rows, return only a random sample of about this many. 0 (default) means no limit and every match is returned.
The result is deliberately incomplete, so use it only when "some good matches" is enough.
For DBAs and operators
When non-zero, a GIN index scan that would return far more TIDs than the limit randomly skips entries so the result is roughly the limit (it is a soft limit; actual counts vary). Values in the thousands (5000–20000) are the documented practical range.
The rows are not the "best" ones: no ranking is involved, and repeated runs return different subsets. count(*) results also become wrong, which surprises people who set it globally. It affects every GIN index scan in the session (full text, jsonb, arrays, pg_trgm), so set it only per session or per query role, never in postgresql.conf.
Modern alternatives: rank with ts_rank and LIMIT, or rewrite very common terms out of the query.
How to change it
Any user can change it for their session with SET.