forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit707867e
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 parent1c0e618 commit707867e
1 file changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
946 | 957 | | |
947 | 958 | | |
948 | 959 | | |
| |||
0 commit comments
Comments
(0)