* append_total_cost_compare * list_sort comparator for sorting append child paths * by total_cost descending * * For equal total costs, we fall back to comparing startup 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.) */
| 1536 | * (This is to avoid getting unpredictable results from list_sort.) |
| 1537 | */ |
| 1538 | static int |
| 1539 | append_total_cost_compare(const ListCell *a, const ListCell *b) |
| 1540 | { |
| 1541 | Path *path1 = (Path *) lfirst(a); |
| 1542 | Path *path2 = (Path *) lfirst(b); |
| 1543 | int cmp; |
| 1544 | |
| 1545 | cmp = compare_path_costs(path1, path2, TOTAL_COST); |
| 1546 | if (cmp != 0) |
| 1547 | return -cmp; |
| 1548 | return bms_compare(path1->parent->relids, path2->parent->relids); |
| 1549 | } |
| 1550 | |
| 1551 | /* |
| 1552 | * append_startup_cost_compare |
nothing calls this directly
no test coverage detected