From cdd6776f5bf846933d18e48de1c16bb5545bbfaa Mon Sep 17 00:00:00 2001
From: amit <amitlangote09@gmail.com>
Date: Tue, 24 Jan 2017 14:22:34 +0900
Subject: [PATCH 2/3] Do not allocate storage for partitioned tables.

Currently, it is not possible to insert any data into a partitioned
table.  So, they're empty at all times, which means it is wasteful to
allocate relfilenode and related storage objects.
---
 src/backend/catalog/heap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 41c0056556..b08af1205d 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -291,6 +291,7 @@ heap_create(const char *relname,
 		case RELKIND_VIEW:
 		case RELKIND_COMPOSITE_TYPE:
 		case RELKIND_FOREIGN_TABLE:
+		case RELKIND_PARTITIONED_TABLE:
 			create_storage = false;
 
 			/*
@@ -1351,7 +1352,12 @@ heap_create_with_catalog(const char *relname,
 			   relkind == RELKIND_TOASTVALUE ||
 			   relkind == RELKIND_PARTITIONED_TABLE);
 
-		heap_create_init_fork(new_rel_desc);
+		/*
+		 * We do not want to create any storage objects for a partitioned
+		 * table.
+		 */
+		if (relkind != RELKIND_PARTITIONED_TABLE)
+			heap_create_init_fork(new_rel_desc);
 	}
 
 	/*
-- 
2.11.0

