SQL Interview: 66 Using FORCE ORDER

SQL Interview: 66 Using FORCE ORDER

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Medium

Question:

You are reviewing T-SQL code and in one query, you find the following:

OPTION (FORCE ORDER)

What is the point of this code, and is it likely to be helpful?

Answer:

FORCE ORDER tells SQL Server to join the tables that are involved in a query, in the order that they are written in the query.

This would be rarely a good idea. In most cases, you want SQL Server working out the appropriate order for joining tables. Using this hint would often be detuning the performance of the query.

2025-07-27