Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Önder Kalacı <onderkalaci@gmail.com>
From: Önder Kalacı <onderkalaci@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>,
Peter Smith <smithpb2250@gmail.com>, "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>,
"wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>, Marco Slot <marco.slot@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-08T16:16:22Z
Lists: pgsql-hackers
Attachments
- v37_0002_use_index_on_subs_when_pub_rep_ident_full.patch (application/octet-stream) patch v37-0002
- v37_0001_use_index_on_subs_when_pub_rep_ident_full.patch (application/octet-stream) patch v37-0001
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
Commits
-
Add the testcases for 89e46da5e5.
- 805b821e77a3 16.0 landed
-
Allow the use of indexes other than PK and REPLICA IDENTITY on the subscriber.
- 89e46da5e511 16.0 landed
-
Rework query relation permission checking
- a61b1f74823c 16.0 cited
-
Generalize ri_RootToPartitionMap to use for non-partition children
- fb958b5da86d 16.0 cited
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited
-
Logical replication
- 665d1fad99e7 10.0 cited