diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 1363b9bd45..4fd8a77f48 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -1833,9 +1833,6 @@ cost_incremental_sort(Path *path, Assert(presorted_keys != 0); - if (!enable_sort) - startup_cost += disable_cost; - if (!enable_incrementalsort) startup_cost += disable_cost; diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 704cfd032d..f920fbff30 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -762,6 +762,15 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path) /* Relation should be OK for parallelism, too. */ Assert(parent_rel->consider_parallel); + if (IsA(new_path, AggPath)) + { + AggPath *path = (AggPath *) new_path; + /* we only care about first step of partial aggregates here */ + if (path->aggsplit == AGGSPLIT_INITIAL_SERIAL) + elog(WARNING, "rel %p adding partial agg path %p startup %f total %f", + parent_rel, path, new_path->startup_cost, new_path->total_cost); + } + /* * As in add_path, throw out any paths which are dominated by the new * path, but throw out the new path if some existing path dominates it. @@ -782,7 +791,10 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path) { /* New path costs more; keep it only if pathkeys are better. */ if (keyscmp != PATHKEYS_BETTER1) + { + elog(WARNING, "A: new path %p rejected because of %p", new_path, old_path); accept_new = false; + } } else if (old_path->total_cost > new_path->total_cost * STD_FUZZ_FACTOR) @@ -799,6 +811,7 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path) else if (keyscmp == PATHKEYS_BETTER2) { /* Costs are about the same, old path has better pathkeys. */ + elog(WARNING, "B: new path %p rejected because of %p", new_path, old_path); accept_new = false; } else if (old_path->total_cost > new_path->total_cost * 1.0000000001) @@ -813,6 +826,7 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path) * cheaper. */ accept_new = false; + elog(WARNING, "C: new path %p rejected because of %p", new_path, old_path); } } @@ -841,6 +855,8 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path) break; } + elog(WARNING, "rel %p path %p adding new = %d", parent_rel, new_path, accept_new); + if (accept_new) { /* Accept the new path: insert it at proper place */