🌐 AI搜索 & 代理 主页
Skip to content

Commit 266543a

Browse files
Use "COPY table TO" for partitioned tables in initial table synchronization.
Commit 4bea91f added support for "COPY table TO" with partitioned tables. This commit enhances initial table synchronization in logical replication to use "COPY table TO" for partitioned tables if possible, instead of "COPY (SELECT ...) TO" variant, improving performance. Author: Ajin Cherian <itsajin@gmail.com> Discussion: https://postgr.es/m/CAFPTHDY=w+xmEof=yyjhbDzaLxhBkoBzKcksEofXcT6EcjMbtQ@mail.gmail.com
1 parent 1e14edc commit 266543a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/replication/logical/tablesync.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,9 @@ copy_table(Relation rel)
10681068
/* Start copy on the publisher. */
10691069
initStringInfo(&cmd);
10701070

1071-
/* Regular table with no row filter or generated columns */
1072-
if (lrel.relkind == RELKIND_RELATION && qual == NIL && !gencol_published)
1071+
/* Regular or partitioned table with no row filter or generated columns */
1072+
if ((lrel.relkind == RELKIND_RELATION || lrel.relkind == RELKIND_PARTITIONED_TABLE)
1073+
&& qual == NIL && !gencol_published)
10731074
{
10741075
appendStringInfo(&cmd, "COPY %s",
10751076
quote_qualified_identifier(lrel.nspname, lrel.relname));

0 commit comments

Comments
 (0)