Re: Logical Replication speed-up initial data

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Nikhil Shetty <nikhil(dot)dba04(at)gmail(dot)com>
Cc: Hüseyin Demir <demirhuseyinn(dot)94(at)gmail(dot)com>, Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication speed-up initial data
Date: 2021-08-05 20:03:00
Message-ID: CAMkU=1wyY7hzqSTZA=Yp7FRJUP-PPbJPoG3z+71iD7X44GatJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Aug 5, 2021 at 12:57 AM Nikhil Shetty <nikhil(dot)dba04(at)gmail(dot)com>
wrote:

> Hi,
>
> Thank you for the suggestion.
>
> We tried by dropping indexes and it worked faster compared to what we saw
> earlier. We wanted to know if anybody has done any other changes that helps
> speed-up initial data load without dropping indexes.
>

If index maintenance is the bottleneck, nothing but dropping the indexes is
likely to be very effective. Just make sure not to drop the replica
identity index. If you do that, then the entire sync will abort and
rollback once it gets to the end, if the master had had any UPDATE or
DELETE activity on that table during the sync period. (v14 will remove
that problem--replication still won't proceed until you have the index, but
previous synced work will not be lost while it waits for you to build the
index.)

Syncing with the index still in place might go faster if shared_buffers is
large enough to hold the entire incipient index(es) simultaneously. It
might be worthwhile to make shared_buffers be a large fraction of RAM (like
90%) if doing so will enable the entire index to fit into shared_buffers
and if nothing else significant is running on the server. You probably
wouldn't want that as a permanent setting though.

Cheers,

Jeff

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alex 2021-08-07 19:35:25 Slow query because lexeme index not used
Previous Message Vijaykumar Jain 2021-08-05 19:20:39 Re: Logical Replication speed-up initial data