Re: Should use MERGE use BulkInsertState ? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Should use MERGE use BulkInsertState ?
Date
Msg-id 202205111523.rhf6veb6i6c5@alvherre.pgsql
Whole thread Raw
In response to Should use MERGE use BulkInsertState ?  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: Should use MERGE use BulkInsertState ?
List pgsql-hackers
On 2022-May-11, Justin Pryzby wrote:

> Should it use it ?
> 
> It occured to me to ask when reading Bruce's release notes, which say:
> | [MERGE] is similar to INSERT ... ON CONFLICT but more batch-oriented.
> 
> Currently, INSERT *never* uses bistate - even INSERT SELECT.
> 
> INSERTing 10k tuples will dirty 10k buffers - not limited to the size of a
> strategy/ring buffer.  Currently, MERGE will do the same.

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.

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.

COPY uses a ring buffer too.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: First draft of the PG 15 release notes
Next
From: Bruce Momjian
Date:
Subject: Re: First draft of the PG 15 release notes