From the course: Database Foundations: Database Management

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Control query plans with hints

Control query plans with hints

From the course: Database Foundations: Database Management

Start my 1-month free trial

Control query plans with hints

- [Instructor] The query optimizers included with each relational database management system have gotten really good over the years. A lot of engineering resources have been poured into making sure that they operate at the highest levels, and choose the most optimal execution plans. So the best practice is to just let them do their job in determining how best to fetch your data and return the results that you've asked for in your queries. However, some RDBMS platforms do allow you to override the query optimizer, and force a particular technique. This involves adding hints into the syntax of your query. To review, let's start with the same query that we executed in the prior movie on SQL server. I'm going to highlight lines two through 11 in the script here, and then press the explain button. When I view the execution plan, SQL server determines that the best way to proceed with this query is to use a couple of nested loop joins between the various tables. We can force the optimizer…

Contents