> Right, because of the reason I posted [1].
>
> I updated the patch which did the same approach. It could pass my CI.
> Could you please apply on 17.2 and test it?
>
> [1]:
>
https://www.postgresql.org/message-id/OSCPR01MB14966B646506E0C9B81B3A4CFF5022%40OSCPR01MB14966.jpnprd01.prod.outlook.com
This is a considerable improvement, the cleanup phase took less than 30s (compared to the former 200s).
However, we are talking of a 12s transaction, that takes an overall 64s to be replicated.
In this particular case, the replication system spends most of its time creating / deleting small files.
Would not be possible to create just one spill file for the main transaction ?