Commit 625d5b3
committed
Allow Incremental Sorts on GiST and SP-GiST indexes
Previously an "amcanorderbyop" index would only be used when the index
could provide sorted results which satisfied all query_pathkeys. Here
we relax this so that we also allow these indexes to be considered by the
planner when they only provide partially sorted results. This allows the
planner to later consider making use of an Incremental Sort to satisfy the
remaining pathkeys. This change is particularly useful for KNN-type
queries which contain a LIMIT clause and an additional ORDER BY clause for
a non-indexed column.
Author: Miroslav Bendik
Reviewed-by: Richard Guo, David Rowley
Discussion: https://postgr.es/m/CAPoEpV0QYDtzjwamwWUBqyWpaCVbJV2d6qOD7Uy09bWn47PJtw%40mail.gmail.com1 parent 28b5726 commit 625d5b3
File tree
3 files changed
+77
-25
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+77
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
977 | | - | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
978 | 983 | | |
979 | 984 | | |
980 | 985 | | |
981 | | - | |
| 986 | + | |
982 | 987 | | |
983 | 988 | | |
984 | | - | |
| 989 | + | |
| 990 | + | |
985 | 991 | | |
986 | 992 | | |
987 | 993 | | |
| |||
3051 | 3057 | | |
3052 | 3058 | | |
3053 | 3059 | | |
3054 | | - | |
3055 | | - | |
3056 | | - | |
3057 | | - | |
3058 | | - | |
3059 | | - | |
3060 | | - | |
3061 | | - | |
3062 | | - | |
3063 | | - | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
3064 | 3072 | | |
3065 | 3073 | | |
3066 | 3074 | | |
3067 | 3075 | | |
3068 | 3076 | | |
3069 | 3077 | | |
3070 | | - | |
3071 | | - | |
3072 | 3078 | | |
3073 | 3079 | | |
3074 | 3080 | | |
| |||
3084 | 3090 | | |
3085 | 3091 | | |
3086 | 3092 | | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
3090 | | - | |
3091 | 3093 | | |
3092 | 3094 | | |
3093 | 3095 | | |
| |||
3133 | 3135 | | |
3134 | 3136 | | |
3135 | 3137 | | |
3136 | | - | |
3137 | | - | |
| 3138 | + | |
| 3139 | + | |
3138 | 3140 | | |
3139 | 3141 | | |
3140 | 3142 | | |
| |||
3144 | 3146 | | |
3145 | 3147 | | |
3146 | 3148 | | |
3147 | | - | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
3148 | 3154 | | |
3149 | 3155 | | |
3150 | | - | |
3151 | | - | |
3152 | | - | |
3153 | 3156 | | |
3154 | 3157 | | |
3155 | 3158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1660 | 1660 | | |
1661 | 1661 | | |
1662 | 1662 | | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
0 commit comments