summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMasahiko Sawada <msawada@postgresql.org>2025-11-20 14:50:27 -0800
committerMasahiko Sawada <msawada@postgresql.org>2025-11-20 14:50:27 -0800
commit266543a62055541ddefe4e66797e0e1e4aa8705a (patch)
tree6a49263e8575f97e96bb7da472aa3978cb69ab11 /src/backend
parent1e14edcea5e1a122d4bf76d30fc963715e4dfe5e (diff)
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
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/replication/logical/tablesync.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index dcc6124cc73..fa8e3bf969a 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1068,8 +1068,9 @@ copy_table(Relation rel)
/* Start copy on the publisher. */
initStringInfo(&cmd);
- /* Regular table with no row filter or generated columns */
- if (lrel.relkind == RELKIND_RELATION && qual == NIL && !gencol_published)
+ /* Regular or partitioned table with no row filter or generated columns */
+ if ((lrel.relkind == RELKIND_RELATION || lrel.relkind == RELKIND_PARTITIONED_TABLE)
+ && qual == NIL && !gencol_published)
{
appendStringInfo(&cmd, "COPY %s",
quote_qualified_identifier(lrel.nspname, lrel.relname));