From c7f123947e9e99fb727e5974a06d225f5ce5c684 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Wed, 26 Feb 2020 08:51:11 +0100 Subject: [PATCH] Make merge tables during re-partitioning unlogged --- src/backend/distributed/worker/worker_merge_protocol.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/backend/distributed/worker/worker_merge_protocol.c b/src/backend/distributed/worker/worker_merge_protocol.c index 2f84f545e..1d39d6072 100644 --- a/src/backend/distributed/worker/worker_merge_protocol.c +++ b/src/backend/distributed/worker/worker_merge_protocol.c @@ -464,12 +464,11 @@ CreateTaskTable(StringInfo schemaName, StringInfo relationName, Assert(schemaName != NULL); Assert(relationName != NULL); - /* - * This new relation doesn't log to WAL, as the table creation and data copy - * statements occur in the same transaction. Still, we want to make the - * relation unlogged once we upgrade to PostgreSQL 9.1. - */ RangeVar *relation = makeRangeVar(schemaName->data, relationName->data, -1); + + /* this table will only exist for the duration of the query, avoid writing to WAL */ + relation->relpersistence = RELPERSISTENCE_UNLOGGED; + List *columnDefinitionList = ColumnDefinitionList(columnNameList, columnTypeList); CreateStmt *createStatement = CreateStatement(relation, columnDefinitionList);