63.5. GIN Tips and Tricks
- Create vs. insert
As ofPostgreSQL 8.4, this advice is less necessary since delayed indexing is used (seeSection 63.4.1 for details). But for very large updates it may still be best to drop and recreate the index.
- maintenance_work_mem
Build time for aGIN index is very sensitive to the
maintenance_work_mem
setting; it doesn't pay to skimp on work memory during index creation.- gin_pending_list_limit
- gin_fuzzy_search_limit
To facilitate controlled execution of such queries,GIN has a configurable soft upper limit on the number of rows returned: the
gin_fuzzy_search_limit
configuration parameter. It is set to 0 (meaning no limit) by default. If a non-zero limit is set, then the returned set is a subset of the whole result set, chosen at random.From experience, values in the thousands (e.g., 5000 — 20000) work well.