pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Date: Mon, 16 Sep 2019 22:29:18 +0300
Message-ID: <50a87b09-a5cd-bb13-1d10-41d4147a8a95@postgrespro.ru> (raw)
In-Reply-To: <b25ce80e-f536-78c8-d5c8-a5df3e230785@postgrespro.ru>
References: <e84013b6-b890-1c4c-2b82-eca185a2197c@2ndquadrant.com>
	<8940f374-6651-26d0-cefe-6c719454b6fe@2ndquadrant.com>
	<40c38758-04b5-74f4-c963-cf300f9e5dff@postgrespro.ru>
	<b95ba070-cd21-72b9-2979-8cdf4d3dd1c6@2ndquadrant.com>
	<126e3a30-a7f5-ede4-2bd0-b217749c8b33@postgrespro.ru>
	<c511125d-33d7-5209-98ce-5c9977f3e437@2ndquadrant.com>
	<f4cf3883-5ce2-6829-bb42-3038bfc7b4d9@postgrespro.ru>
	<8eda5118-2dd0-79a1-4fe9-eec7e334de17@postgrespro.ru>
	<20190828190646.s3bjs22urff32k56@development>
	<bb84dcf8-0a7d-5c8b-9cea-7186dc3acc3c@postgrespro.ru>
	<20190829184824.kmrbchrk2ged6vjw@development>
	<322e40c4-8ca7-6c34-2544-28a6d95989c2@postgrespro.ru>
	<b25ce80e-f536-78c8-d5c8-a5df3e230785@postgrespro.ru>



On 16.09.2019 19:54, Alexey Kondratov wrote:
> On 30.08.2019 18:59, Konstantin Knizhnik wrote:
>>
>> I think that instead of defining savepoints it is simpler and more 
>> efficient to use
>>
>> BeginInternalSubTransaction + 
>> ReleaseCurrentSubTransaction/RollbackAndReleaseCurrentSubTransaction
>>
>> as it is done in PL/pgSQL (pl_exec.c).
>> Not sure if it can pr
>>
>
> Both BeginInternalSubTransaction and DefineSavepoint use 
> PushTransaction() internally for a normal subtransaction start. So 
> they seems to be identical from the performance perspective, which is 
> also stated in the comment section:

Yes, definitely them are using the same mechanism and most likely 
provides similar performance.
But BeginInternalSubTransaction does not require to generate some 
savepoint name which seems to be redundant in this case.


>
> Anyway, I've performed a profiling of my apply worker (flamegraph is 
> attached) and it spends the vast amount of time (>90%) applying 
> changes. So the problem is not in the savepoints their-self, but in 
> the fact that we first apply all changes and then abort all the work. 
> Not sure, that it is possible to do something in this case.
>

Looks like the only way to increase apply speed is to do it in parallel: 
make it possible to concurrently execute non-conflicting transactions.







view thread (536+ messages)  latest in thread

Message-ID: <50a87b09-a5cd-bb13-1d10-41d4147a8a95@postgrespro.ru>
Permalink:  ../50a87b09-a5cd-bb13-1d10-41d4147a8a95@postgrespro.ru/
Also on:    postgresql.org/message-id/50a87b09-a5cd-bb13-1d10-41d4147a8a95@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: k.knizhnik@postgrespro.ru, a.kondratov@postgrespro.ru, tomas.vondra@2ndquadrant.com, peter.eisentraut@2ndquadrant.com, er@xs4all.nl, sawada.mshk@gmail.com
  Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
  In-Reply-To: <50a87b09-a5cd-bb13-1d10-41d4147a8a95@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox