Re: Data is copied twice when specifying both child and parent table in publication
Jacob Champion <jchampion@timescale.com>
From: Jacob Champion <jchampion@timescale.com>
To: Amit Kapila <amit.kapila16@gmail.com>,
"wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>
Cc: Andres Freund <andres@anarazel.de>, vignesh C <vignesh21@gmail.com>,
Peter Smith <smithpb2250@gmail.com>,
"Takamichi Osumi (Fujitsu)" <osumi.takamichi@fujitsu.com>,
"shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>,
"houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>,
Amit Langote <amitlangote09@gmail.com>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
"pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>,
Dilip Kumar <dilipbalaut@gmail.com>, Greg Nancarrow <gregn4422@gmail.com>
Date: 2023-03-27T23:01:59Z
Lists: pgsql-hackers
On Mon, Mar 20, 2023 at 11:22 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > If the tests you have in mind are only related to this patch set then > feel free to propose them here if you feel the current ones are not > sufficient. I think the new tests added by Wang cover my concerns (thanks!). I share Peter's comment that we don't seem to have a regression test covering only the bug description itself -- just ones that combine that case with row and column restrictions -- but if you're all happy with the existing approach then I have nothing much to add there. I was staring at this subquery in fetch_table_list(): > + " ( SELECT array_agg(a.attname ORDER BY a.attnum)\n" > + " FROM pg_attribute a\n" > + " WHERE a.attrelid = gpt.relid AND\n" > + " a.attnum = ANY(gpt.attrs)\n" > + " ) AS attnames\n" On my machine this takes up roughly 90% of the runtime of the query, which makes for a noticeable delay with a bigger test case (a couple of FOR ALL TABLES subscriptions on the regression database). And it seems like we immediately throw all that work away: if I understand correctly, we only use the third column for its interaction with DISTINCT. Would it be enough to just replace that whole thing with gpt.attrs? Thanks, --Jacob
Commits
-
Avoid syncing data twice for the 'publish_via_partition_root' option.
- 062a84442424 16.0 landed
-
Fix partition table's REPLICA IDENTITY checking on the subscriber.
- 52d5ea9adb01 14.5 cited
-
Prohibit combining publications with different column lists.
- fd0b9dcebda7 15.0 cited
-
Fix double publish of child table's data.
- 3f06c00cf6dc 13.6 landed
- 614b77d65a38 14.2 landed
- 5e97905a2c76 15.0 landed
-
Support adding partitioned tables to publication
- 17b9e7f9fe23 13.0 cited