]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Use streaming read for VACUUM cleanup of GIN
authorMichael Paquier <michael@paquier.xyz>
Thu, 12 Mar 2026 02:48:31 +0000 (11:48 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 12 Mar 2026 02:48:31 +0000 (11:48 +0900)
commit6c228755add8f0714677440d53a160f9ed332902
tree0188905ff22445a2275e1561cf40db7f2d0940ca
parent383eb21ebffe9ddd97dca03e529fa363580e7ccf
Use streaming read for VACUUM cleanup of GIN

This commit replace the synchronous ReadBufferExtended() loop done in
ginvacuumcleanup() with the streaming read equivalent, to improve I/O
efficiency during GIN index vacuum cleanup operations.

With dm_delay to emulate some latency and debug_io_direct=data to force
synchronous writes and force the read path to be exercised, the author
has noticed a 5x improvement in runtime, with a substantial reduction in
IO stats numbers.  I have reproduced similar numbers while running
similar tests, with improvements becoming better with more tuples and
more pages manipulated.

Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com
src/backend/access/gin/ginvacuum.c