forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit44b5d56
committed
Tidy up code in get_cheapest_group_keys_order()
There are a few things that we could do a little better withinget_cheapest_group_keys_order():1. We should be using list_free() rather than pfree() on a List.2. We should use for_each_from() instead of manually coding a for loop toskip the first n elements of a List3. list_truncate(list_copy(...), n) is not a great way to copy the first nelements of a list. Let's invent list_copy_head() for that. That way wedon't need to copy the entire list just to truncate it directlyafterwards.4. We can simplify finding the cheapest cost by setting the cheapest costvariable to DBL_MAX. That allows us to skip special-casing the initialiteration of the loop.Author: David RowleyDiscussion:https://postgr.es/m/CAApHDvrGyL3ft8waEkncG9y5HDMu5TFFJB1paoTC8zi9YK97Nw@mail.gmail.comBackpatch-through: 15, where get_cheapest_group_keys_order was added.1 parent12c99c8 commit44b5d56
File tree
3 files changed
+40
-16
lines changed- src
- backend
- nodes
- optimizer/path
- include/nodes
3 files changed
+40
-16
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1544 | 1544 |
| |
1545 | 1545 |
| |
1546 | 1546 |
| |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1547 | 1568 |
| |
1548 | 1569 |
| |
1549 | 1570 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| 20 | + | |
| 21 | + | |
20 | 22 |
| |
21 | 23 |
| |
22 | 24 |
| |
| |||
591 | 593 |
| |
592 | 594 |
| |
593 | 595 |
| |
594 |
| - | |
| 596 | + | |
595 | 597 |
| |
596 | 598 |
| |
597 | 599 |
| |
| |||
620 | 622 |
| |
621 | 623 |
| |
622 | 624 |
| |
623 |
| - | |
624 | 625 |
| |
| 626 | + | |
625 | 627 |
| |
626 |
| - | |
627 |
| - | |
628 |
| - | |
629 |
| - | |
630 |
| - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
631 | 633 |
| |
632 |
| - | |
633 |
| - | |
634 |
| - | |
| 634 | + | |
| 635 | + | |
635 | 636 |
| |
636 |
| - | |
637 |
| - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
638 | 640 |
| |
639 |
| - | |
| 641 | + | |
640 | 642 |
| |
641 | 643 |
| |
642 | 644 |
| |
| |||
646 | 648 |
| |
647 | 649 |
| |
648 | 650 |
| |
649 |
| - | |
| 651 | + | |
650 | 652 |
| |
651 |
| - | |
| 653 | + | |
652 | 654 |
| |
653 | 655 |
| |
654 | 656 |
| |
| |||
689 | 691 |
| |
690 | 692 |
| |
691 | 693 |
| |
692 |
| - | |
| 694 | + | |
693 | 695 |
| |
694 | 696 |
| |
695 | 697 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
599 | 599 |
| |
600 | 600 |
| |
601 | 601 |
| |
| 602 | + | |
602 | 603 |
| |
603 | 604 |
| |
604 | 605 |
| |
|
0 commit comments
Comments
(0)