On Mon, Mar 11, 2019 at 2:58 AM David Fetter <david@fetter.org> wrote:
On Wed, Mar 06, 2019 at 10:06:27PM +0800, Paul Guo wrote: > Hello, Postgres hackers, > > The copy code has used batch insert with function heap_multi_insert() to > speed up. It seems that Create Table As or Materialized View could leverage > that code also to boost the performance also. Attached is a patch to > implement that.
This is great!
Is this optimization doable for multi-row INSERTs, either with tuples spelled out in the body of the query or in constructs like INSERT ... SELECT ...?
Yes. That's "batch insert" in the ModifyTable nodes which I mentioned in the first email.
By the way, batch is a usual optimization mechanism for iteration kind model (like postgres executor),
so batch should benefit many executor nodes in theory also.