Re: Making aggregate deserialization (and WAL receive) functions slightly faster

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Making aggregate deserialization (and WAL receive) functions slightly faster
Date: 2023-11-07 02:15:02
Message-ID: CAA4eK1K_=AEs83K1JczbYkGiTzyk=0P_Y9Ef=808ZQk3m=bFRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 7, 2023 at 3:56 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Thu, 2 Nov 2023 at 22:42, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > The other two look good to me.
>
> Thanks for looking.
>
> I spent some time trying to see if the performance changes much with
> either of these cases. For the XLogWalRcvProcessMsg() I was unable to
> measure any difference even when replaying inserts into a table with a
> single int4 column and no indexes. I think that change is worthwhile
> regardless as it allows us to get rid of a global variable. I was
> tempted to shorten the name of that variable a bit since it's now
> local, but didn't as it causes a bit more churn.
>
> For the apply_spooled_messages() change, I tried logical decoding but
> quickly saw apply_spooled_messages() isn't the normal case. I didn't
> quite find a test case that caused the changes to be serialized to a
> file, but I do see that the number of bytes can be large so thought
> that it's worthwhile saving the memcpy for that case.
>

Yeah, and another reason is that the usage of StringInfo becomes
consistent with LogicalRepApplyLoop(). One can always configure the
lower value of logical_decoding_work_mem or use
debug_logical_replication_streaming for a smaller number of changes to
follow that code path. But I am not sure how much practically it will
help because we are anyway reading file to apply the changes.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-11-07 02:22:40 Re: Popcount optimization using AVX512
Previous Message Peter Smith 2023-11-07 01:33:07 Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)