Re: Insert values() per-statement overhead

From: Andres Freund <andres(at)anarazel(dot)de>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Insert values() per-statement overhead
Date: 2016-01-15 10:34:57
Message-ID: 20160115103457.axvczo4on6wpfifw@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016-01-15 13:17:12 +0300, Vladimir Sitnikov wrote:
> There is a finding that insert(x) values(y);insert(x) values(z); is
> 2-4 times slower than insert(..) values(y),(z);
> see [1], [2].

If you indeed just mean statements like above, without begin/commit, a
large portion of the overhead will be transactional overhead. But
I guess you mean there's a transaction surrounding it?

If not, quite possibly what you're describing is client round trip
latency? How exactly are these issued? There'll be some overhead of
running two statements rather than one, but if you have neither added
transactional overhead, nor latency issues, the difference isn't *that*
big in my experience.

> Is it something that was discussed previously?

Yes.

I think the biggestoverhead here is that the executor startup includes
too many indirect (linked lists) datastructured, that allocated each
round. And that some datastructures are computed at execution time
(ExecTypeFromTL I'm looking at you). Unfortunately changing that is not
a small project.

Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2016-01-15 10:36:00 Re: Minor comment update in setrefs.c
Previous Message Vladimir Sitnikov 2016-01-15 10:17:12 Insert values() per-statement overhead