When Should I Use An Index Hint?

preview_player
Показать описание
Index hints are useful tools that are easily abused. In today's video, learn when it's appropriate to use an index hint and when they should be avoided.

Blog post with demo code:

Follow me on Twitter:
Рекомендации по теме
Комментарии
Автор

Pls elaborate on "fixing the root cause". I agree index hints are bad, but if statistics are updated and everything else is in order to let SQL Server choose the best plan and it still does not, then index hints (in rare cases) might be a life saver...

TorgeirFredriksen
Автор

Yet another reason I hate index hints: If you remove or rename an index used in a hint, you completely break that query using the index hint. The optimizer won't be able to produce a plan if the hinted index doesn't exist. On the plus side, this can break your application in a rather spectacular fashion. Just ask the application that broke a few weeks ago when I dropped a duplicate index.

AMtwobe