The most noticeable thing about that is that the worst percentage-wise cases appear near the bottom end of the range. And indeed inspection of individual entries showed that trivial cases like SELECT (ROW(1, 2) < ROW(1, 3)) AS "true" were hurting the most percentage-wise. After some study I decided that the only thing that could explain that was the two rounds of construct-an-upper-rel-and-add-paths-to-it happening in grouping_planner. I was able to get rid of one of them by discarding the notion of UPPERREL_INITIAL altogether, and instead having the code apply the desired tlist in-place, like this: sub_target = make_subplanTargetList(root, tlist, &groupColIdx); /* * Forcibly apply that tlist to all the Paths for the scan/join rel. * * In principle we should re-run set_cheapest() here to identify the * cheapest path, but it seems unlikely that adding the same tlist * eval costs to all the paths would change that, so we don't bother. * Instead, just assume that the cheapest-startup and cheapest-total * paths remain so. (There should be no parameterized paths anymore, * so we needn't worry about updating cheapest_parameterized_paths.) */ foreach(lc, current_rel->pathlist) { Path *subpath = (Path *) lfirst(lc); Path *path; Assert(subpath->param_info == NULL); path = apply_projection_to_path(root, current_rel, subpath, sub_target); /* If we had to add a Result, path is different from subpath */ if (path != subpath) { lfirst(lc) = path; if (subpath == current_rel->cheapest_startup_path) current_rel->cheapest_startup_path = path; if (subpath == current_rel->cheapest_total_path) current_rel->cheapest_total_path = path; } } With that fixed, the scatter plot looks like: