Each time you write and execute a T-SQL Query in SQL Server, the Database Engine selects the most optimized query plan for executing the query.
. Given the T-SQL query itself as well as the underlying database(s) design, the Query Optimizer selects the best execution plan for the query and then it executes the query.
. Though, as SQL Server Query Optimizer typically selects the best execution plan for a query, it is not recommended for inexperienced developers and administrators to make use of them.
Similar examples:
SELECT *
FROM TABLE_NAME A WITH (NOLOCK)
GO
SELECT *
FROM TABLE_NAME (NOLOCK)
GO
SELECT *
FROM TABLE_NAME A (NOLOCK)
GO
For environments where many concurrent queries are executed against the same database objects (i.e. Web Applications), the NOLOCK hint can become quite handy. By using this hint, the transaction isolation level for the SELECT statement is READ UNCOMMITTED. Of course, this means that the query may see inconsistent data, that is data not yet committed, etc. So, if this is not a problem for you, it might solve many concurrency issues.
Though note that in general is not a good idea to apply the above practice as a rule.
I hope you found this post useful!
Until next time!