The OPTION ( LOOP JOIN ) would enforce LOOP JOIN across all joins in the query. Using the OPTION ( LOOP JOIN ) appears to allows the query optimizer to join the tables using the nested loops in which ever order SQL server decides it is optimal. The OPTION clause must be a last clause in a statement. The syntax is,
Now, Lets see how to use LOOP JOIN with SELECT statement.?
The statement returned execution plan is,
The above statement loops through all the joins that starts from sales details and goes by bank details to employee details in which the order that SQL server thinks it is optimal. This does not follow the order of joins that we specify. Suppose, if you want the SQL server to follow the order of joins that you specify you have to use FORCE ORDER in OPTION clause.
However, the two types of query hints cannot be mixed in a statement. Suppose, if you attempt to do so you will get an 1042 error.
In this statement we are using both MERGE and LOOP JOIN query hint that you can see in the above statement that causes the 1042 error. The statement returned result is,
Now, Lets see how to use LOOP JOIN with SELECT statement.?
The statement returned execution plan is,
The above statement loops through all the joins that starts from sales details and goes by bank details to employee details in which the order that SQL server thinks it is optimal. This does not follow the order of joins that we specify. Suppose, if you want the SQL server to follow the order of joins that you specify you have to use FORCE ORDER in OPTION clause.
However, the two types of query hints cannot be mixed in a statement. Suppose, if you attempt to do so you will get an 1042 error.
In this statement we are using both MERGE and LOOP JOIN query hint that you can see in the above statement that causes the 1042 error. The statement returned result is,
Comments
What are the Difficulties of Using Open Research Data in clinical research?
Research paper support
Research paper publications
Empirical data from research
data collection services