// Calculate the amount of memory reserved for the query int64 ResourceManagerGetQueryMemoryLimit(PlannedStmt* stmt) { if (Gp_role != GP_ROLE_DISPATCH) return 0; /* no limits in single user mode. */ if (!IsUnderPostmaster) // 如果是postmaster的子进程,则IsUnderPostmaster为true。 return 0; Assert(gp_session_id > -1); Assert(ActivePortal != NULL); if (IsResQueueEnabled()) return ResourceQueueGetQueryMemoryLimit(stmt, ActivePortal->queueId); if (IsResGroupActivated()) return ResourceGroupGetQueryMemoryLimit(); return 0; }