Avoid invalidating all RelationSyncCache entries on publication change.
authorAmit Kapila
Thu, 6 Mar 2025 08:49:38 +0000 (14:19 +0530)
committerAmit Kapila
Thu, 6 Mar 2025 08:49:38 +0000 (14:19 +0530)
commit588acf6d0ec15d9384c2f712585c0f56936d7bac
tree8657a2bbbb5cf65e96f36832f65f971c86699436
parent1d33de9d683722bfa14e436e30a8f5b999a4e2e7
Avoid invalidating all RelationSyncCache entries on publication change.

On change of publication via ALTER PUBLICATION ... SET/ADD/DROP commands,
we were invalidating all the relations present in relation sync cache
maintained by pgoutput. We need to invalidate only the relation entries
that are changed as part of publication DDL.

We have ensured that the publication DDL execution generated the
invalidations required to invalidate impacted relation sync entries in
RelationSyncCache.

This improves the performance by avoiding building the cache entries for
the cases where a publication has many tables but only one of them is
dropped.

Author: Shlok Kyal 
Author: Hayato Kuroda 
Reviewed-by: Hou Zhijie
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/OSCPR01MB14966C09AA201EFFA706576A7F5C92@OSCPR01MB14966.jpnprd01.prod.outlook.com
src/backend/replication/pgoutput/pgoutput.c