* 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.) */
| 1558 | * (This is to avoid getting unpredictable results from list_sort.) |
| 1559 | */ |
| 1560 | static int |
| 1561 | append_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 |
nothing calls this directly
no test coverage detected