diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 731610c701..06feb779a6 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -3012,9 +3012,11 @@ index_build(Relation heapRelation,
 	 * only btree has support for parallel builds.
 	 *
 	 * Note that planner considers parallel safety for us.
+	 * In stand-alone mode, parallel index building should not be considered since
+	 * there is only one process.
 	 */
 	if (parallel && IsNormalProcessingMode() &&
-		indexRelation->rd_rel->relam == BTREE_AM_OID)
+		indexRelation->rd_rel->relam == BTREE_AM_OID && IsPostmasterEnvironment && !IsBackendStandAlone())
 		indexInfo->ii_ParallelWorkers =
 			plan_create_index_workers(RelationGetRelid(heapRelation),
 									  RelationGetRelid(indexRelation));
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 72e3352398..778aec987d 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -405,6 +405,7 @@ extern ProcessingMode Mode;
 	} while(0)
 
 
+#define IsBackendStandAlone()	(!IsBootstrapProcessingMode() && !IsPostmasterEnvironment)
 /*
  * Auxiliary-process type identifiers.  These used to be in bootstrap.h
  * but it seems saner to have them here, with the ProcessingMode stuff.
