Hello,

we are using gin indexes on big tables. these tables happen to have several
billion rows.
the index creation fails in ginCombineData in src/backend/access/ginbulk.c
because repalloc is limited to 1 gb.
this limitation makes no sense in this context (compare comments in
src/include/utils/memutils.h).
To overcome this limitation on tables with lots of rows repalloc_huge is
used.
The test suite still succeeds on my machine.
Find the patch attached,

Kind regards,

Robert Abraham
*** a/src/backend/access/gin/ginbulk.c
--- b/src/backend/access/gin/ginbulk.c
***************
*** 39,45 **** ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
  		accum->allocatedMemory -= GetMemoryChunkSpace(eo->list);
  		eo->maxcount *= 2;
  		eo->list = (ItemPointerData *)
! 			repalloc(eo->list, sizeof(ItemPointerData) * eo->maxcount);
  		accum->allocatedMemory += GetMemoryChunkSpace(eo->list);
  	}
  
--- 39,45 ----
  		accum->allocatedMemory -= GetMemoryChunkSpace(eo->list);
  		eo->maxcount *= 2;
  		eo->list = (ItemPointerData *)
! 			repalloc_huge(eo->list, sizeof(ItemPointerData) * eo->maxcount);
  		accum->allocatedMemory += GetMemoryChunkSpace(eo->list);
  	}
  
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to