diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c
index 7dc43f1ea79017acc024b7cfd4a5211e2945fabd..3eb3d4d9a4e2b65f26925f2aa55d701c3022afd7 100644
--- a/src/backend/utils/mmgr/dsa.c
+++ b/src/backend/utils/mmgr/dsa.c
@@ -755,6 +755,22 @@ dsa_allocate(dsa_area *area, Size size)
 	return alloc_object(area, size_class);
 }
 
+/*
+ * As dsa_allocate, but zeroes the allocated memory.
+ */
+dsa_pointer
+dsa_allocate0(dsa_area *area, Size size)
+{
+	dsa_pointer dp;
+	char	   *object;
+
+	dp = dsa_allocate(area, size);
+	object = dsa_get_address(area, dp);
+	memset(object, 0, size);
+
+	return dp;
+}
+
 /*
  * Free memory obtained with dsa_allocate.
  */
diff --git a/src/include/utils/dsa.h b/src/include/utils/dsa.h
index bb634e77cdaa59deb94a41c6d5f51abae3d10e09..3fd9bbd3a5027a1ea490fd938a91d11276c76405 100644
--- a/src/include/utils/dsa.h
+++ b/src/include/utils/dsa.h
@@ -106,6 +106,7 @@ extern void dsa_set_size_limit(dsa_area *area, Size limit);
 extern Size dsa_minimum_size(void);
 extern dsa_handle dsa_get_handle(dsa_area *area);
 extern dsa_pointer dsa_allocate(dsa_area *area, Size size);
+extern dsa_pointer dsa_allocate0(dsa_area *area, Size size);
 extern void dsa_free(dsa_area *area, dsa_pointer dp);
 extern void *dsa_get_address(dsa_area *area, dsa_pointer dp);
 extern void dsa_trim(dsa_area *area);