src/backend/utils/resource_manager/memquota.c: /* * ComputeAvgMemKBForMemIntenseOp * Compute the average memory limit for each memory-intensive operators * in a given group. * * If there is no memory-intensive operators in this group, return 0. */ static uint64 ComputeAvgMemKBForMemIntenseOp(OperatorGroupNode *groupNode) { if (groupNode->numMemIntenseOps == 0) { return 0; } const uint64 nonMemIntenseOpMemKB = (uint64)(*gp_resmanager_memory_policy_auto_fixed_mem); return (((double)groupNode->groupMemKB - (double)groupNode->numNonMemIntenseOps * nonMemIntenseOpMemKB) / groupNode->numMemIntenseOps); }