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: Amit Kapila <amit.kapila16@gmail.com>
Cc: 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-07T13:47:07Z
Lists: pgsql-hackers
Attachments
- v35_0002_use_index_on_subs_when_pub_rep_ident_full.patch (application/octet-stream) patch v35-0002
- v35_0001_use_index_on_subs_when_pub_rep_ident_full.patch (application/octet-stream) patch v35-0001
Hi Amit, Peter > > > Let me give an example to demonstrate why I thought something is fishy > here: > > > > > > Imagine rel has a (non-default) REPLICA IDENTITY with Oid=1111. > > > Imagine the same rel has a PRIMARY KEY with Oid=2222. > > > > Hmm, alright, this is syntactically possible, but not sure if any user would do this. Still thanks for catching this. And, you are right, if a user has created such a schema, IdxIsRelationIdentityOrPK() would return the wrong result and we'd use sequential scan instead of index scan. This would be a regression. I think we should change the function. Here is the example: DROP TABLE tab1; CREATE TABLE tab1 (a int NOT NULL); CREATE UNIQUE INDEX replica_unique ON tab1(a); ALTER TABLE tab1 REPLICA IDENTITY USING INDEX replica_unique; ALTER TABLE tab1 ADD CONSTRAINT pkey PRIMARY KEY (a); I'm attaching v35. Does that make sense to you Amit?
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