Commit c651020
committed
Remove redundant PARTITION BY columns from WindowClauses
Here we adjust the query planner to have it remove items from a window
clause's PARTITION BY clause in cases where the pathkey for a column in
the PARTITION BY clause is redundant.
Doing this allows the optimization added in 9d9c02c to stop window
aggregation early rather than going into "pass-through" mode to find
tuples belonging to the next partition. Also, when we manage to remove
all PARTITION BY columns, we now no longer needlessly check that the
current tuple belongs to the same partition as the last tuple in
nodeWindowAgg.c. If the pathkey was redundant then all tuples must
contain the same value for the given redundant column, so there's no point
in checking that during execution.
Author: David Rowley
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/CAApHDvo2ji+hdxrxfXtRtsfSVw3to2o1nCO20qimw0dUGK8hcQ@mail.gmail.com1 parent 4637a6a commit c651020
File tree
3 files changed
+46
-14
lines changed- src
- backend/optimizer/plan
- include/nodes
3 files changed
+46
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2623 | 2623 | | |
2624 | 2624 | | |
2625 | 2625 | | |
2626 | | - | |
2627 | | - | |
2628 | | - | |
2629 | | - | |
2630 | | - | |
2631 | | - | |
| 2626 | + | |
2632 | 2627 | | |
2633 | 2628 | | |
2634 | 2629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5999 | 5999 | | |
6000 | 6000 | | |
6001 | 6001 | | |
| 6002 | + | |
| 6003 | + | |
| 6004 | + | |
6002 | 6005 | | |
6003 | 6006 | | |
6004 | 6007 | | |
| |||
6007 | 6010 | | |
6008 | 6011 | | |
6009 | 6012 | | |
6010 | | - | |
6011 | | - | |
| 6013 | + | |
6012 | 6014 | | |
6013 | 6015 | | |
6014 | 6016 | | |
| |||
6022 | 6024 | | |
6023 | 6025 | | |
6024 | 6026 | | |
6025 | | - | |
6026 | | - | |
6027 | | - | |
6028 | | - | |
6029 | | - | |
6030 | | - | |
| 6027 | + | |
| 6028 | + | |
| 6029 | + | |
| 6030 | + | |
| 6031 | + | |
| 6032 | + | |
| 6033 | + | |
| 6034 | + | |
| 6035 | + | |
| 6036 | + | |
| 6037 | + | |
| 6038 | + | |
| 6039 | + | |
| 6040 | + | |
| 6041 | + | |
| 6042 | + | |
| 6043 | + | |
| 6044 | + | |
| 6045 | + | |
| 6046 | + | |
| 6047 | + | |
| 6048 | + | |
| 6049 | + | |
| 6050 | + | |
| 6051 | + | |
| 6052 | + | |
| 6053 | + | |
| 6054 | + | |
| 6055 | + | |
| 6056 | + | |
| 6057 | + | |
| 6058 | + | |
| 6059 | + | |
| 6060 | + | |
| 6061 | + | |
| 6062 | + | |
| 6063 | + | |
| 6064 | + | |
| 6065 | + | |
6031 | 6066 | | |
6032 | 6067 | | |
6033 | 6068 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
1476 | 1478 | | |
1477 | 1479 | | |
1478 | 1480 | | |
| |||
0 commit comments