Re: Logical Replication of sequences - Mailing list pgsql-hackers

From Nisha Moond
Subject Re: Logical Replication of sequences
Date
Msg-id CABdArM6=ru-ozpKv06pGUzy7qTrTKYrVRUFLjtiX3gBavH0igw@mail.gmail.com
Whole thread Raw
In response to Re: Logical Replication of sequences  (Shlok Kyal <shlok.kyal.oss@gmail.com>)
List pgsql-hackers
On Wed, Jun 25, 2025 at 3:10 PM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>
>
> 4. Since we are not adding sequences in the list 'sub_remove_rels',
> should we only palloc for (the count of no. of tables)? Is it worth
> the effort?
> /*
> * Rels that we want to remove from subscription and drop any slots
> * and origins corresponding to them.
> */
> sub_remove_rels = palloc(subrel_count * sizeof(SubRemoveRels));
>

The sub_remove_rels array allocates memory for all relations in the
subscription, even though it only uses entries for those that are
actually removed.
While this may result in unnecessary allocation, even when only tables
are involved. OTOH, as it’s a short-lived variable, pre-allocating can
help with performance.
This requires further analysis, I plan to handle this in the next version.

--
Thanks,
Nisha



pgsql-hackers by date:

Previous
From: Nisha Moond
Date:
Subject: Re: Logical Replication of sequences
Next
From: Ashutosh Bapat
Date:
Subject: Report bytes and transactions actually sent downtream