Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimizing a query
Message
From
09/09/2008 16:02:38
 
 
To
09/09/2008 14:18:54
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 6.5 and older
Miscellaneous
Thread ID:
01345942
Message ID:
01346210
Views:
4
>>If the potential for dirty reads is not an issue, you could add 'WITH (NOLOCK)' table hint to eliminate locks during the select
>>
>>
>>SELECT Client.Numero FROM Client WITH (NOLOCK)
>>  WHERE Client.NoEntity=@NoEntity AND Client.Fic_Date<@Fic_Date 
>> 	AND Client.Loss_Code=@Loss_Code AND Client.CType=@CType
>> 	AND EXISTS ( SELECT 1 FROM Invoice WITH (NOLOCK) WHERE Client.Numero=Invoice.NoClient 
>>                AND Invoice.Amount=@Amount)
>>
>
>Could you define "dirty reads"? Also, is the NOLOCK ANSI SQL compliant?

NOLOCK and dirty reads

There is a discussion here

http://www.sql-server-performance.com/articles/per/lock_contention_nolock_rowlock_p2.aspx

Basically, using the NOLOCK hint, you might read data in an uncomitted transaction that could be rolled back after you read it.

I don't know if it is ANSI SQL compliant. I suspect not.
Previous
Reply
Map
View

Click here to load this message in the networking platform