[SERVER-62362] Hints are allowed on special indexes like 2d and text but lead to incorrect results Created: 05/Jan/22 Updated: 14/Apr/22 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Mathias Stearn | Assignee: | Katya Kamenieva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
We should do one of A) disallow these hints, B) ignore the hints, C) (somehow) make them produce the correct query results. I strongly prefer option A or B with a slight preference for A over B.
I didn't test with "somewhat special" indexes like partial indexes or filtered indexes, but they may have the same issue. |
| Comments |
| Comment by David Storch [ 07/Jan/22 ] | |||||||||||||||||
|
I'm marking this ticket as related to SERVER-26413, which describes a similar issue for partial indexes, and SERVER-18449, which describes a similar issue for sparse indexes. | |||||||||||||||||
| Comment by James Wahlin [ 05/Jan/22 ] | |||||||||||||||||
|
Sparse indexes have the same issue:
I agree that it would be reasonable to not allow hints to affect query correctness. | |||||||||||||||||
| Comment by Mathias Stearn [ 05/Jan/22 ] | |||||||||||||||||
|
james.wahlin I realized that I actually meant sparse rather than (or in addition to) partial indexes. Do sparse indexes also have the same issue? It seems like a reasonable rule should be that hint() is not allowed to change the results of a query, only how it is executed. (This obviously only applies to a single snapshot/version or to a quiescent system, so we don't consider it a problem if the altered query plan changes which concurrent modifications you do or do not observe) | |||||||||||||||||
| Comment by James Wahlin [ 05/Jan/22 ] | |||||||||||||||||
|
Partial / filtered indexes are in the same position and this has been known/accepted behavior. Definitely worth revisiting and also considering whether text and geo indexes should be handled in the same way. |