Avoid unnecessary GinFormTuple() calls for incompressible posting lists.
authorMasahiko Sawada <[email protected]>
Mon, 6 Oct 2025 21:02:01 +0000 (14:02 -0700)
committerMasahiko Sawada <[email protected]>
Mon, 6 Oct 2025 21:02:01 +0000 (14:02 -0700)
commit771cfe22a0982f8716abfa253707e74fbbad873a
treec2988ab121b11426763bdc5a6d1ff24786b6f49e
parentec8719ccbfcd78c6b40b5f2b94f60769f3bd08aa
Avoid unnecessary GinFormTuple() calls for incompressible posting lists.

Previously, we attempted to form a posting list tuple even when
ginCompressPostingList() failed to compress the posting list due to
its size. While there was no functional failure, it always wasted one
GinFormTuple() call when item pointers didn't fit in a posting list
tuple.

This commit ensures that a GIN index tuple is formed only when all
item pointers in the posting list are successfully compressed.

Author: Arseniy Mukhin <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: https://postgr.es/m/CAE7r3M+C=jcpTD93f_RBHrQp3C+=TAXFs+k4tTuZuuxboK8AvA@mail.gmail.com
src/backend/access/gin/gininsert.c