Re: Insert values() per-statement overhead - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Insert values() per-statement overhead
Date
Msg-id 20160115103457.axvczo4on6wpfifw@alap3.anarazel.de
Whole thread Raw
In response to Insert values() per-statement overhead  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Responses Re: Insert values() per-statement overhead  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Insert values() per-statement overhead
Next
From: Etsuro Fujita
Date:
Subject: Re: Minor comment update in setrefs.c