Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

From: Önder Kalacı <onderkalaci(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, "wangw(dot)fnst(at)fujitsu(dot)com" <wangw(dot)fnst(at)fujitsu(dot)com>, Marco Slot <marco(dot)slot(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Date: 2023-03-08 16:16:22
Message-ID: CACawEhWyzmQcXSZpmFDSKvv_Vqz594D2vEox6CvEn=c4nO2DoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Vignesh C,

>
> Few comments
> 1) Maybe this change is not required:
> fallback if no other solution is possible. If a replica identity other
> than <quote>full</quote> is set on the publisher side, a replica
> identity
> - comprising the same or fewer columns must also be set on the subscriber
> - side. See <xref linkend="sql-altertable-replica-identity"/> for
> details on
> + comprising the same or fewer columns must also be set on the
> subscriber side.
> + See <xref linkend="sql-altertable-replica-identity"/> for details on
>

Yes, fixed.

>
> 2) Variable declaration and the assignment can be split so that the
> readability is better:
> +
> + bool isUsableIndex =
> + IsIndexUsableForReplicaIdentityFull(indexInfo);
> +
> + index_close(indexRelation, AccessShareLock);
> +

Hmm, can you please elaborate more on this? The declaration
and assignment are already on different lines.

ps: pgindent changed this line a bit. Does that look better?

3) Since there is only one statement within the if condition, the
> braces can be removed
> + if (is_btree && !is_partial && !is_only_on_expression)
> + {
> + return true;
> + }
>
>
Fixed on a newer version of the patch. Now it is only:

*return is_btree && !is_partial && !is_only_on_expression;*

> 4) There is minor indentation issue in this, we could run pgindent to fix
> it:
> +static Oid FindLogicalRepLocalIndex(Relation localrel,
> +
> LogicalRepRelation *remoterel);
> +
>
>
Yes, pgindent fixed it, thanks.

Attached v37

Thanks,
Onder KALACI

Attachment Content-Type Size
v37_0002_use_index_on_subs_when_pub_rep_ident_full.patch application/octet-stream 9.2 KB
v37_0001_use_index_on_subs_when_pub_rep_ident_full.patch application/octet-stream 68.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-03-08 16:23:48 Re: Add documentation for coverage reports with meson
Previous Message Pavel Stehule 2023-03-08 16:07:37 Re: Schema variables - new implementation for Postgres 15