Re: row filtering for logical replication
От | Greg Nancarrow |
---|---|
Тема | Re: row filtering for logical replication |
Дата | |
Msg-id | CAJcOf-c2+WbjeP7NhwgcAEtsn9KdDnhrsowheafbZ9+QU9C8SQ@mail.gmail.com обсуждение исходный текст |
Ответ на | RE: row filtering for logical replication ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>) |
Список | pgsql-hackers |
On Tue, Feb 1, 2022 at 2:45 PM houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com> wrote: > > Attach the V75 patch set which address the above, Amit's[1] and Greg's[2][3] comments. > In the v74-0001 patch (and now in the v75-001 patch) a change was made in the GetTopMostAncestorInPublication() function, to get the relation and schema publications lists (for the ancestor Oid) up-front: + List *apubids = GetRelationPublications(ancestor); + List *aschemaPubids = GetSchemaPublications(get_rel_namespace(ancestor)); + + if (list_member_oid(apubids, puboid) || + list_member_oid(aschemaPubids, puboid)) + topmost_relid = ancestor; However, it seems that this makes it less efficient in the case a match is found in the first list that is searched, since then there was actually no reason to create the second list. Instead of this, how about something like this: List *apubids = GetRelationPublications(ancestor); List *aschemaPubids = NULL; if (list_member_oid(apubids, puboid) || list_member_oid(aschemaPubids = GetSchemaPublications(get_rel_namespace(ancestor)), puboid)) topmost_relid = ancestor; or, if that is considered a bit ugly due to the assignment within the function parameters, alternatively: List *apubids = GetRelationPublications(ancestor); List *aschemaPubids = NULL; if (list_member_oid(apubids, puboid)) topmost_relid = ancestor; else { aschemaPubids = GetSchemaPublications(get_rel_namespace(ancestor)); if (list_member_oid(aschemaPubids, puboid)) topmost_relid = ancestor; } Regards, Greg Nancarrow Fujitsu Australia
В списке pgsql-hackers по дате отправления: