Re: Is a VACUUM or ANALYZE necessary after logical replication?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Koen De Groote <kdg(dot)dev(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Is a VACUUM or ANALYZE necessary after logical replication?
Date: 2024-06-16 07:09:17
Message-ID: CAKFQuwbkJ0z8Hz88u3xUtB55nMxzaycFxZAdB1t=BNUBn17YUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday, June 15, 2024, Koen De Groote <kdg(dot)dev(at)gmail(dot)com> wrote:

> I've gone over all of https://www.postgresql.org/docs/current/logical-
> replication.html and the only mentions of the word "index" I could find
> was in relation to replica identity and examples of table definitions
> showing primary key indexes.
>
> Nothing is said about indexes. Maybe for good reason, maybe they are fully
> functionality immediately after replication?
>
> So the main question: Once a table is fully replicated, do I need to
> vacuum(analyze) that table, or are the indexes on that table already
> functional?
>

The whole point of “logical” replication is that the
inserts/updates/deletes are reapplied on the secondary against the table
and the whatever triggers, indexes, or whatnot exist on that table in the
secondary behave just as if you connected to the server directly and issued
the corresponding SQL against it. As far as the replication system is
concerned none of those things on the primary matter nor does it have to
care about them on the secondary.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2024-06-16 09:27:35 Re: DROP COLLATION vs pg_collation question
Previous Message Achilleas Mantzios 2024-06-16 06:54:58 Re: Is a VACUUM or ANALYZE necessary after logical replication?