Remove some redundant set_cheapest() calls.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Mar 2024 20:02:37 +0000 (16:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Mar 2024 20:02:44 +0000 (16:02 -0400)
Commit e2fa76d80 centralized the responsibility for doing
set_cheapest() for a baserel, but these functions added later
seemingly didn't get the memo.  There's no apparent reason why
we need the cheapest path for these relation types to be available
any sooner than it is for other base relation types, so delete the
duplicate calls.  Doesn't save much since there's only one path
in these cases, but it might improve clarity.

Richard Guo

Discussion: https://postgr.es/m/CAMbWs4-KFEU_fDuJPNCOkUu3rwvZvKBEytkd9VrM4kH4-2h1CQ@mail.gmail.com

src/backend/optimizer/path/allpaths.c

index 95f3368c2146ac125676b44c5360dc66cc81dc61..7bad4044580ee7889fbe60697c5902ad590ffd97 100644 (file)
@@ -2966,9 +2966,6 @@ set_namedtuplestore_pathlist(PlannerInfo *root, RelOptInfo *rel,
 
        /* Generate appropriate path */
        add_path(rel, create_namedtuplestorescan_path(root, rel, required_outer));
-
-       /* Select cheapest path (pretty easy in this case...) */
-       set_cheapest(rel);
 }
 
 /*
@@ -2996,9 +2993,6 @@ set_result_pathlist(PlannerInfo *root, RelOptInfo *rel,
 
        /* Generate appropriate path */
        add_path(rel, create_resultscan_path(root, rel, required_outer));
-
-       /* Select cheapest path (pretty easy in this case...) */
-       set_cheapest(rel);
 }
 
 /*