Re: [HACKERS] Insert values() per-statement overhead

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Insert values() per-statement overhead
Date: 2018-04-01 21:11:43
Message-ID: CAB=Je-Gps4Kiu-2tXqAHSrtt4mAU6PQaC0E1ocVmgVHrieGYYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres>I think the biggestoverhead here is that the executor startup
includes
Andres>too many indirect (linked lists) datastructured, that allocated each
Andres>round

The case is very common: batch inserts are popular in Java, and ORMs use
batch API automatically.
However, there's high per-backend-message overhead, and that overhead is
very noticeable.

What is the approach to handle this?

Folding multiple DML statements into one with a help of CTE does not work
either (see https://github.com/pgjdbc/pgjdbc/issues/1165 ):

CTE doc>Trying to update the same row twice in a single statement is not
supported. Only one of the modifications takes place, but it is not easy
(and sometimes not possible) to reliably predict which one

Vladimir

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2018-04-01 21:54:20 Re: Diagonal storage model
Previous Message Gavin Flower 2018-04-01 21:11:27 Re: bulk typos