forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf8f6e44

Etsuro Fujita
postgres_fdw: Improve cost and size estimation for aggregate pushdown.
In commit7012b13, which added aggregatepushdown to postgres_fdw, we didn't account for the evaluation cost and theselectivity of HAVING quals attached to ForeignPaths performing aggregatepushdown, as core had never accounted for that for AggPaths and GroupPaths.And we didn't set these values of the locally-checked quals (ie, fpinfo'slocal_conds_cost and local_conds_sel), which were initialized to zeros, butsince estimate_path_cost_size factors in these to estimate the result sizeand the evaluation cost of such a ForeignPath when the use_remote_estimateoption is enabled, this caused it to produce underestimated results in thatcase.By commit7b6c075 core was changed so thatit accounts for the evaluation cost and the selectivity of HAVING quals inaggregation paths, so change the postgres_fdw's aggregate pushdown code aswell as such. This not only fixes the underestimation issue mentionedabove, but improves the estimation using local statistics in that functionwhen that option is disabled.This would be a bug fix rather than an improvement, but apply it to HEADonly to avoid destabilizing existing plan choices.Author: Etsuro FujitaDiscussion:https://postgr.es/m/5BFD3EAD.2060301%40lab.ntt.co.jp1 parentafc4a78 commitf8f6e44
File tree
3 files changed
+54
-7
lines changed- contrib/postgres_fdw
- expected
- sql
3 files changed
+54
-7
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3209 | 3209 |
| |
3210 | 3210 |
| |
3211 | 3211 |
| |
| 3212 | + | |
| 3213 | + | |
3212 | 3214 |
| |
3213 | 3215 |
| |
3214 | 3216 |
| |
|
Lines changed: 49 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2844 | 2844 |
| |
2845 | 2845 |
| |
2846 | 2846 |
| |
2847 |
| - | |
2848 |
| - | |
2849 |
| - | |
2850 |
| - | |
2851 | 2847 |
| |
2852 | 2848 |
| |
2853 | 2849 |
| |
| |||
2880 | 2876 |
| |
2881 | 2877 |
| |
2882 | 2878 |
| |
2883 |
| - | |
2884 |
| - | |
| 2879 | + | |
| 2880 | + | |
2885 | 2881 |
| |
2886 |
| - | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
2887 | 2899 |
| |
2888 | 2900 |
| |
2889 | 2901 |
| |
| |||
2909 | 2921 |
| |
2910 | 2922 |
| |
2911 | 2923 |
| |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
2912 | 2938 |
| |
2913 | 2939 |
| |
2914 | 2940 |
| |
| |||
5496 | 5522 |
| |
5497 | 5523 |
| |
5498 | 5524 |
| |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
5499 | 5541 |
| |
5500 | 5542 |
| |
5501 | 5543 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
807 | 807 |
| |
808 | 808 |
| |
809 | 809 |
| |
| 810 | + | |
| 811 | + | |
| 812 | + | |
810 | 813 |
| |
811 | 814 |
| |
812 | 815 |
| |
|
0 commit comments
Comments
(0)