Optimization of Memory Operations in Generalized Search Trees of PostgreSQL

Our team is working on new algorithms for intra-page indexing in PostgreSQL generalized search trees. During this work, we encountered that slight modification of the algorithm for modification of a tuple on a page can significantly affect the performance. This effect is caused by optimization of page compaction operations and speeds up inserts and updates of a data. Most important performance improvement is gained using sorted data insertion, time to insert data into an index can be reduced by a factor of 3. For a randomized data performance increase is around 15%. Size of the index also significantly reduced. This paper describes implementation and evaluation of the technique in PostgreSQL codebase. Proposed patch is committed to upstream and expected to be released with the PostgreSQL 10.