RE: Selectively invalidate caches in pgoutput module
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: "ShlokKumar.Kyal@fujitsu.com" <ShlokKumar.Kyal@fujitsu.com>, 'Amit Kapila' <amit.kapila16@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-10T13:12:00Z
Lists: pgsql-hackers
Attachments
- v9-0001-Introduce-a-new-invalidation-message-to-invalidat.patch (application/octet-stream) patch v9-0001
- v9-0002-Invalidate-Relcaches-while-ALTER-PUBLICATION-RENA.patch (application/octet-stream) patch v9-0002
Dear Hou, > Currently, only the leaf partition is invalidated when the published table is > partitioned. However, I think pgoutput could cache both the partitioned table > and the leaf partition table as relsync entries. > > For INSERT/UPDATE/DELETE on a partitioned table, only the leaf partition's > relsync entry is used in pgoutput, but the TRUNCATE references the parent > table's relsync entry. I think your analysis is correct. PSA new version. Below part contains my analysis. In ExecuteTruncate(), if the specified relation has children, all of them are checked via find_all_inheritors() and listed as target. Also, ExecuteTruncateGuts() serializes both a parent and children in XLOG_HEAP_TRUNCATE WAL record. Decoding layer passes relations as-is. These facts mean that output plugins can store caches on the memory. Best regards, Hayato Kuroda FUJITSU LIMITED
Commits
-
Avoid invalidating all RelationSyncCache entries on publication rename.
- 3abe9dc18892 18.0 landed
-
Avoid invalidating all RelationSyncCache entries on publication change.
- 588acf6d0ec1 18.0 landed