Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Date: 2020-06-09 10:09:39
Message-ID: CAA4eK1L3PoiBw6uogB7jD5rmdT-GmEF4kOEccS1AWKuBhSkQkQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 4, 2020 at 5:06 PM Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
wrote:

> On Fri, 29 May 2020 at 15:52, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
>

> To see all the operations(DDL's and DML's), please see test_results
> <https://docs.google.com/spreadsheets/d/1g11MrSd_I39505OnGoLFVslz3ykbZ1nmfR_gUiE_O9k/edit?usp=sharing>
>
> *Testing summary:*
> Basically, we are writing per command invalidation message and for testing
> that I have tested with different combinations of the DDL and DML
> operation. I have not observed any performance degradation with the patch.
> For "create index" DDL's, %change in wal is 1-7% for 1-15 DDL's. For "add
> col int/date" DDL's, it is 11-17% for 1-15 DDL's and for "add col text"
> DDL's, it is 2-6% for 1-15 DDL's. For mix (DDL & DML), it is 2-10%.
>
> why are we seeing 11-13 % of the extra wall, basically, the amount of
> extra WAL is not very high but the amount of WAL generated with add column
> int/date is just ~1000 bytes so additional 100 bytes will be around 10% and
> for add column text it is ~35000 bytes so % is less. For text, these
> ~35000 bytes are due to toast
> There is no change in wal size for *DML operations*. For savepoints, we
> are getting max 8 bytes per savepoint wal increment (basically for
> Sub-transaction, we are adding 5 bytes to store xid but due to padding, it
> is 8 bytes and some times if wal is already aligned, then we are getting 0
> bytes increment)
>

So, if I read it correctly, there is no performance penalty with either of
the patches but there is some additional WAL which in most cases is 2-5%
but in worst cases and some specific DDL's it is upto 15%. I think as this
WAL overhead is when wal_level is logical, we might have to live with it as
the other alternative is to blew up all caches on any DDL in WALSenders and
that will have bot CPU and Network overhead as expalined previously [1]. I
feel if the WAL overhead pinches any workload, we might want to do it under
some new guc (which will disable streaming of transactions) but I don't
think we need to go there.

What do you think?

[1] -
https://www.postgresql.org/message-id/CAA4eK1JaKW1mj4L6DPnk-V4vXJ6hM%3DKcf6%2B-X%2B93Jk56UN%2BkGw%40mail.gmail.com

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-06-09 10:22:21 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Andrew Gierth 2020-06-09 10:08:34 Re: Speedup usages of pg_*toa() functions