forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitff72280
committed
When we have successfully optimized a MIN or MAX aggregate into an indexscan,
the query result must be exactly one row (since we don't do this when there'sany GROUP BY). Therefore any ORDER BY or DISTINCT attached to the query isuseless and can be dropped. Aside from saving useless cycles, this protectsus against problems with matching the hacked-up tlist entries to sort clauses,as seen in a bug report from Taiki Yamaguchi. We might need to work harderif we ever try to optimize grouped queries with this approach, but thissolution will do for now.1 parent39627b1 commitff72280
1 file changed
+12
-1
lines changedLines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
950 | 950 |
| |
951 | 951 |
| |
952 | 952 |
| |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
953 | 964 |
| |
954 | 965 |
| |
955 | 966 |
| |
|
0 commit comments
Comments
(0)