v1-0001-Support-for-COPY-TO-for-partitioned-tables-in-tab.patch
application/octet-stream
Filename: v1-0001-Support-for-COPY-TO-for-partitioned-tables-in-tab.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Support for COPY TO for partitioned tables in tablesync
| File | + | − |
|---|---|---|
| src/backend/replication/logical/tablesync.c | 3 | 2 |
From 370517cad57eb36cd93e1b5ef5135561732b1505 Mon Sep 17 00:00:00 2001
From: Ajin Cherian <itsajin@gmail.com>
Date: Tue, 11 Nov 2025 13:43:16 +1100
Subject: [PATCH v1] Support for COPY TO for partitioned tables in tablesync
This commit modifies tablesync logic to use COPY TO for partitioned tables. Performance tests
show it's faster than the COPY (SELECT ...) TO variant as it avoids the overheads of
query processing and sending results to the COPY TO command.
---
src/backend/replication/logical/tablesync.c | 5 +++--
1 file 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));
--
2.47.3