forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite222534
committed
Treat number of disabled nodes in a path as a separate cost metric.
Previously, when a path type was disabled by e.g. enable_seqscan=false,we either avoided generating that path type in the first place, ormore commonly, we added a large constant, called disable_cost, to theestimated startup cost of that path. This latter approach can distortplanning. For instance, an extremely expensive non-disabled pathcould seem to be worse than a disabled path, especially if the fullcost of that path node need not be paid (e.g. due to a Limit).Or, as in the regression test whose expected output changes with thiscommit, the addition of disable_cost can make two paths that wouldnormally be distinguishible in cost seem to have fuzzily the same cost.To fix that, we now count the number of disabled path nodes andconsider that a high-order component of both the startup cost and thetotal cost. Hence, the path list is now sorted by disabled_nodes andthen by total_cost, instead of just by the latter, and likewise forthe partial path list. It is important that this number is a countand not simply a Boolean; else, as soon as we're unable to respectdisabled path types in all portions of the path, we stop trying toavoid them where we can.Because the path list is now sorted by the number of disabled nodes,the join prechecks must compute the count of disabled nodes duringthe initial cost phase instead of postponing it to final cost time.Counts of disabled nodes do not cross subquery levels; at present,there is no reason for them to do so, since the we do not postponepath selection across subquery boundaries (see make_subplan).Reviewed by Andres Freund, Heikki Linnakangas, and David Rowley.Discussion:http://postgr.es/m/CA+TgmoZ_+MS+o6NeGK2xyBv-xM+w1AfFVuHE4f_aq6ekHv7YSQ@mail.gmail.com1 parent2b03cfe commite222534
File tree
15 files changed
+357
-127
lines changed- contrib
- file_fdw
- postgres_fdw
- src
- backend/optimizer
- path
- plan
- prep
- util
- include
- nodes
- optimizer
- test
- isolation/specs
- regress/expected
15 files changed
+357
-127
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
576 | 576 |
| |
577 | 577 |
| |
578 | 578 |
| |
| 579 | + | |
579 | 580 |
| |
580 | 581 |
| |
581 | 582 |
| |
|
Lines changed: 39 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
430 | 430 |
| |
431 | 431 |
| |
432 | 432 |
| |
| 433 | + | |
433 | 434 |
| |
434 | 435 |
| |
435 | 436 |
| |
| |||
442 | 443 |
| |
443 | 444 |
| |
444 | 445 |
| |
| 446 | + | |
445 | 447 |
| |
446 | 448 |
| |
447 | 449 |
| |
| |||
735 | 737 |
| |
736 | 738 |
| |
737 | 739 |
| |
| 740 | + | |
738 | 741 |
| |
739 | 742 |
| |
740 | 743 |
| |
| |||
765 | 768 |
| |
766 | 769 |
| |
767 | 770 |
| |
| 771 | + | |
768 | 772 |
| |
769 | 773 |
| |
770 | 774 |
| |
| |||
1030 | 1034 |
| |
1031 | 1035 |
| |
1032 | 1036 |
| |
| 1037 | + | |
1033 | 1038 |
| |
1034 | 1039 |
| |
1035 | 1040 |
| |
| |||
1184 | 1189 |
| |
1185 | 1190 |
| |
1186 | 1191 |
| |
| 1192 | + | |
1187 | 1193 |
| |
1188 | 1194 |
| |
1189 | 1195 |
| |
1190 | 1196 |
| |
1191 | 1197 |
| |
1192 | 1198 |
| |
1193 |
| - | |
| 1199 | + | |
1194 | 1200 |
| |
1195 | 1201 |
| |
1196 | 1202 |
| |
| |||
1203 | 1209 |
| |
1204 | 1210 |
| |
1205 | 1211 |
| |
| 1212 | + | |
1206 | 1213 |
| |
1207 | 1214 |
| |
1208 | 1215 |
| |
| |||
3079 | 3086 |
| |
3080 | 3087 |
| |
3081 | 3088 |
| |
3082 |
| - | |
| 3089 | + | |
3083 | 3090 |
| |
3084 | 3091 |
| |
3085 | 3092 |
| |
| |||
3088 | 3095 |
| |
3089 | 3096 |
| |
3090 | 3097 |
| |
| 3098 | + | |
3091 | 3099 |
| |
3092 | 3100 |
| |
3093 | 3101 |
| |
3094 | 3102 |
| |
3095 | 3103 |
| |
3096 | 3104 |
| |
| 3105 | + | |
3097 | 3106 |
| |
3098 | 3107 |
| |
3099 | 3108 |
| |
| |||
3483 | 3492 |
| |
3484 | 3493 |
| |
3485 | 3494 |
| |
| 3495 | + | |
3486 | 3496 |
| |
3487 | 3497 |
| |
3488 | 3498 |
| |
| |||
3577 | 3587 |
| |
3578 | 3588 |
| |
3579 | 3589 |
| |
| 3590 | + | |
3580 | 3591 |
| |
3581 | 3592 |
| |
3582 | 3593 |
| |
| |||
3637 | 3648 |
| |
3638 | 3649 |
| |
3639 | 3650 |
| |
| 3651 | + | |
3640 | 3652 |
| |
3641 | 3653 |
| |
3642 | 3654 |
| |
| |||
3656 | 3668 |
| |
3657 | 3669 |
| |
3658 | 3670 |
| |
| 3671 | + | |
3659 | 3672 |
| |
3660 | 3673 |
| |
3661 | 3674 |
| |
| |||
6147 | 6160 |
| |
6148 | 6161 |
| |
6149 | 6162 |
| |
| 6163 | + | |
6150 | 6164 |
| |
6151 | 6165 |
| |
6152 | 6166 |
| |
6153 | 6167 |
| |
6154 | 6168 |
| |
6155 | 6169 |
| |
6156 |
| - | |
| 6170 | + | |
| 6171 | + | |
6157 | 6172 |
| |
6158 | 6173 |
| |
6159 | 6174 |
| |
| |||
6175 | 6190 |
| |
6176 | 6191 |
| |
6177 | 6192 |
| |
| 6193 | + | |
6178 | 6194 |
| |
6179 | 6195 |
| |
6180 | 6196 |
| |
| |||
6188 | 6204 |
| |
6189 | 6205 |
| |
6190 | 6206 |
| |
| 6207 | + | |
6191 | 6208 |
| |
6192 | 6209 |
| |
6193 | 6210 |
| |
| |||
6335 | 6352 |
| |
6336 | 6353 |
| |
6337 | 6354 |
| |
| 6355 | + | |
6338 | 6356 |
| |
6339 | 6357 |
| |
6340 | 6358 |
| |
| |||
6424 | 6442 |
| |
6425 | 6443 |
| |
6426 | 6444 |
| |
6427 |
| - | |
| 6445 | + | |
| 6446 | + | |
6428 | 6447 |
| |
6429 | 6448 |
| |
6430 | 6449 |
| |
6431 | 6450 |
| |
6432 | 6451 |
| |
| 6452 | + | |
6433 | 6453 |
| |
6434 | 6454 |
| |
6435 | 6455 |
| |
| |||
6441 | 6461 |
| |
6442 | 6462 |
| |
6443 | 6463 |
| |
| 6464 | + | |
6444 | 6465 |
| |
6445 | 6466 |
| |
6446 | 6467 |
| |
| |||
6768 | 6789 |
| |
6769 | 6790 |
| |
6770 | 6791 |
| |
| 6792 | + | |
6771 | 6793 |
| |
6772 | 6794 |
| |
6773 | 6795 |
| |
| |||
6818 | 6840 |
| |
6819 | 6841 |
| |
6820 | 6842 |
| |
6821 |
| - | |
| 6843 | + | |
| 6844 | + | |
6822 | 6845 |
| |
6823 | 6846 |
| |
6824 | 6847 |
| |
6825 | 6848 |
| |
| 6849 | + | |
6826 | 6850 |
| |
6827 | 6851 |
| |
6828 | 6852 |
| |
| |||
6831 | 6855 |
| |
6832 | 6856 |
| |
6833 | 6857 |
| |
| 6858 | + | |
6834 | 6859 |
| |
6835 | 6860 |
| |
6836 | 6861 |
| |
| |||
6859 | 6884 |
| |
6860 | 6885 |
| |
6861 | 6886 |
| |
| 6887 | + | |
6862 | 6888 |
| |
6863 | 6889 |
| |
6864 | 6890 |
| |
| |||
6952 | 6978 |
| |
6953 | 6979 |
| |
6954 | 6980 |
| |
6955 |
| - | |
| 6981 | + | |
| 6982 | + | |
6956 | 6983 |
| |
6957 | 6984 |
| |
6958 | 6985 |
| |
| |||
6965 | 6992 |
| |
6966 | 6993 |
| |
6967 | 6994 |
| |
| 6995 | + | |
6968 | 6996 |
| |
6969 | 6997 |
| |
6970 | 6998 |
| |
| |||
6998 | 7026 |
| |
6999 | 7027 |
| |
7000 | 7028 |
| |
| 7029 | + | |
7001 | 7030 |
| |
7002 | 7031 |
| |
7003 | 7032 |
| |
| |||
7082 | 7111 |
| |
7083 | 7112 |
| |
7084 | 7113 |
| |
| 7114 | + | |
7085 | 7115 |
| |
7086 | 7116 |
| |
7087 | 7117 |
| |
| |||
7199 | 7229 |
| |
7200 | 7230 |
| |
7201 | 7231 |
| |
7202 |
| - | |
| 7232 | + | |
| 7233 | + | |
7203 | 7234 |
| |
7204 | 7235 |
| |
7205 | 7236 |
| |
| |||
7218 | 7249 |
| |
7219 | 7250 |
| |
7220 | 7251 |
| |
| 7252 | + | |
7221 | 7253 |
| |
7222 | 7254 |
| |
7223 | 7255 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
| 65 | + | |
65 | 66 |
| |
66 | 67 |
| |
67 | 68 |
| |
|
0 commit comments
Comments
(0)