]> granicus.if.org Git - postgresql/commit
Improve the performance of relation deletes during recovery.
authorFujii Masao <fujii@postgresql.org>
Wed, 4 Jul 2018 17:21:15 +0000 (02:21 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 4 Jul 2018 17:26:22 +0000 (02:26 +0900)
commit8463be060d4c4b67b1382607433ea1a3a51002e5
tree1505b310cd1d28962f67058f487ab78f74a0fa29
parentc2c69d43addb23cde95eb428ef85902d52529251
Improve the performance of relation deletes during recovery.

When multiple relations are deleted at the same transaction,
the files of those relations are deleted by one call to smgrdounlinkall(),
which leads to scan whole shared_buffers only one time. OTOH,
previously, during recovery, smgrdounlink() (not smgrdounlinkall()) was
called for each file to delete, which led to scan shared_buffers
multiple times. Obviously this could cause to increase the WAL replay
time very much especially when shared_buffers was huge.

To alleviate this situation, this commit changes the recovery so that
it also calls smgrdounlinkall() only one time to delete multiple
relation files.

This is just fix for oversight of commit 279628a0a7, not new feature.
So, per discussion on pgsql-hackers, we concluded to backpatch this
to all supported versions.

Author: Fujii Masao
Reviewed-by: Michael Paquier, Andres Freund, Thomas Munro, Kyotaro Horiguchi, Takayuki Tsunakawa
Discussion: https://postgr.es/m/CAHGQGwHVQkdfDqtvGVkty+19cQakAydXn1etGND3X0PHbZ3+6w@mail.gmail.com
src/backend/access/transam/twophase.c
src/backend/access/transam/xact.c
src/backend/storage/smgr/md.c
src/include/storage/smgr.h