0

I want to use SELECT WITH NOLOCK, the table on which i want to use SELECT WITH NOLOCK query have no updation query and the data i want to fetch are less the current inserted record.I want to use NOLOCK because sometime i am getting Timeout exception in SELECT query. I think this is because of Table would be LOCKED by Insert query which is running constantly and SELECT query have to wait for long time so it's giving Timeout error.

So please suggest should i use NOLOCK here, I have read some post were written about uncommitted transaction and they suggest not to use NOLOCK.

Manish Kumar
  • 595
  • 2
  • 5
  • 20
  • 1
    **Try,** Answered already for your question [here](https://stackoverflow.com/questions/210171/effect-of-nolock-hint-in-select-statements) – Harisudhan. A Jun 05 '17 at 11:08

2 Answers2

0

As mentionned in the documentation (Table Hints on MSDN Docs), while using the NOLOCK hint, you can see results that are not yet committed (ie. committed by a transaction).

By using this hint you should be aware about these issues, but if it doesn't affect your logic, you can use it.

Rom Eh
  • 1,981
  • 1
  • 16
  • 33
0

Not only you can "see results that are not yet committed " but you can read some rows twice or not read them at all. So we cannot advice you nothing without knowing your table structure and your query. If you are blocked even when reading "data less the current inserted record" may be you just have no appropriate index on your table?

sepupic
  • 8,409
  • 1
  • 9
  • 20