PostgreSQL 9.4.1 Documentation | |||
---|---|---|---|
Prev | Up | Chapter 58. GIN Indexes | Next |
58.5. GIN Tips and Tricks
- Create vs. insert
Insertion into aGIN index can be slow due to the likelihood of many keys being inserted for each item. So, for bulk insertions into a table it is advisable to drop the GIN index and recreate it after finishing bulk insertion.
As ofPostgreSQL 8.4, this advice is less necessary since delayed indexing is used (seeSection 58.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 themaintenance_work_mem setting; it doesn't pay to skimp on work memory during index creation.
- work_mem
During a series of insertions into an existingGIN index that hasFASTUPDATE enabled, the system will clean up the pending-entry list whenever the list grows larger thanwork_mem. To avoid fluctuations in observed response time, it's desirable to have pending-list cleanup occur in the background (i.e., via autovacuum). Foreground cleanup operations can be avoided by increasingwork_mem or making autovacuum more aggressive. However, enlargingwork_mem means that if a foreground cleanup does occur, it will take even longer.
- gin_fuzzy_search_limit