On Wed, May 11, 2022 at 05:23:27PM +0200, Alvaro Herrera wrote: > As I understand it, the point of using a ring is to throttle performance > for bulk operations such as vacuum. I'm not sure why we would want to > throttle either MERGE or INSERT; it seems to me that we should want them > to go as fast as possible.
The point of the ring/strategy buffer is to avoid a seq scan/vacuum/COPY clobbering the entire buffer cache when processing a table larger than shared_buffers. It also makes backends doing bulk operations responsible for their own writes, rather than leaving other backends to clean up all their dirty buffers. > If MERGE were to use a ring buffer, why wouldn't UPDATE do the same? > There are some comments to that effect in src/backend/buffer/README -- > they do mention UPDATE/DELETE and not INSERT. It seems to me that these > three commands (MERGE/UPDATE/DELETE) should be handled in similar ways, > so I don't think we need to consider lack of MERGE using a ring buffer > an open item for pg15. I tend to think that a bulk commad either should or, at least, should be *able* to use a ring buffer. The README doesn't consider INSERTs, but that's the one that we'd be most interested in. I guess you're right that MERGE ought to do what the existing commands are doing. -- Justin