3 ms·
A hint won't make the query planner use an index column it doesn't know it can use, though.
by mike_hock 5y ago
A hint won't make the query planner use an index column it doesn't know it can use, though.
- lazide 5y agoIt does tell the query planner it can use it though.
- deleted 5y ago[deleted]
- SpicyLemonZest 5y ago"Doesn't know it can use" in this context means the system probably doesn't know how to use it, even if a hint suggests it should.
- lazide 5y agoMany times it's not that, or specifically that type of behavior doesn't cause the weird 'something randomly blows up' type problems. It's that it is using index size vs on disk size or something for specific query values and deciding to do something kind of dumb, like a full range scan, because it isn't taking into account the disk data is on... well disk, and the index is already loaded into memory because of other queries. Semi-locking it to known good indexes or whatever, or at least overriding it's attempt to be smart, helps usually in cases like this as it cuts out the long tail behavior and makes the whole system more predictable.
- mike_hock 5y agoYes. But in this case it isn't that.
- jeff-davis 5y agoRight, hints can only tell the database to use features it already has, they don't add new features on the fly. I think the hints discussion is interesting, but not relevant to this particular article.