sql-servert-sqllockingnolock

SQL SERVER, will select query with (TABLOCKX) faster than with(NOLOCK) or vice versa?


I had question above question. We are using with nolock through out the application. In some cases I need to work select faster, what ever the effect.

So select with(TABLOCKX) will be faster or with(nolock)?


Solution

  • To answer your question, the with (nolock) table hint will be faster.

    NOLOCK typically (depending on your DB engine) means give me your data, and I don't care what state it is in, and don't bother holding it still while you read from it. It is all at once faster, less resource-intensive, and very very dangerous.

    As explained very well here NoLock