| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Masahiko Sawada' <sawada(dot)mshk(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Jan Wieck <jan(at)wi3ck(dot)info>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | RE: Initial COPY of Logical Replication is too slow |
| Date: | 2026-03-31 11:39:01 |
| Message-ID: | OS9PR01MB1214911ABEEB9C5AEED005B93F553A@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dear Sawada-san,
Thanks for updating the patch! Few comments.
01.
```
+/*
+ * Similar to is_publishable_calss() but checks whether the given OID
+ * is a publishable "table" or not.
+ */
+static bool
+is_publishable_table(Oid tableoid)
```
s/is_publishable_calss/is_publishable_class/.
02.
```
+ ReleaseSysCache(tuple);
+ return true;
```
Is it correct? I expected to return false here.
03.
```
+ /*
+ * Preliminary check if the specified table can be published in the
+ * first place. If not, we can return early without checking the given
+ * publications and the table.
+ */
+ if (filter_by_relid && !is_publishable_table(target_relid))
+ SRF_RETURN_DONE(funcctx);
```
I think we must switch to the old context.
04.
```
+CREATE PUBLICATION pub_all_except FOR ALL TABLES EXCEPT TABLE (tbl_parent, gpt_test_sch.tbl_sch) WITH (publish_via_partition_root = false);
+CREATE PUBLICATION pub_all_except_no_viaroot FOR ALL TABLES EXCEPT TABLE (tbl_parent, gpt_test_sch.tbl_sch) WITH (publish_via_partition_root = true);
```
It needs to be rebased due to 5984ea86.
05.
```
CREATE VIEW pg_publication_tables AS
SELECT
P.pubname AS pubname,
N.nspname AS schemaname,
C.relname AS tablename,
( SELECT array_agg(a.attname ORDER BY a.attnum)
FROM pg_attribute a
WHERE a.attrelid = GPT.relid AND
a.attnum = ANY(GPT.attrs)
) AS attnames,
pg_get_expr(GPT.qual, GPT.relid) AS rowfilter
FROM pg_publication P,
LATERAL pg_get_publication_tables(P.pubname) GPT,
pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE C.oid = GPT.relid;
```
Can we use the new API of pg_get_publication_tables() here? Below change can pass
tests on my env.
```
- LATERAL pg_get_publication_tables(P.pubname) GPT,
- pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace)
- WHERE C.oid = GPT.relid;
+ pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace),
+ LATERAL pg_get_publication_tables(ARRAY[P.pubname], C.oid) GPT;
```
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-03-31 12:06:22 | Re: [Proposal] Adding Log File Capability to pg_createsubscriber |
| Previous Message | Daniel Gustafsson | 2026-03-31 11:35:33 | Re: Eliminating SPI / SQL from some RI triggers - take 3 |