MCPcopy Create free account
hub / github.com/apache/cloudberry / append_startup_cost_compare

Function append_startup_cost_compare

src/backend/optimizer/util/pathnode.c:1560–1571  ·  view source on GitHub ↗

* append_startup_cost_compare * list_sort comparator for sorting append child paths * by startup_cost descending * * For equal startup costs, we fall back to comparing total costs; if those * are equal too, break ties using bms_compare on the paths' relids. * (This is to avoid getting unpredictable results from list_sort.) */

Source from the content-addressed store, hash-verified

1558 * (This is to avoid getting unpredictable results from list_sort.)
1559 */
1560static int
1561append_startup_cost_compare(const ListCell *a, const ListCell *b)
1562{
1563 Path *path1 = (Path *) lfirst(a);
1564 Path *path2 = (Path *) lfirst(b);
1565 int cmp;
1566
1567 cmp = compare_path_costs(path1, path2, STARTUP_COST);
1568 if (cmp != 0)
1569 return -cmp;
1570 return bms_compare(path1->parent->relids, path2->parent->relids);
1571}
1572
1573/*
1574 * create_merge_append_path

Callers

nothing calls this directly

Calls 2

compare_path_costsFunction · 0.85
bms_compareFunction · 0.85

Tested by

no test coverage detected