Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2008
>On a specific SQL command, if I use NOLOCK, does this mean I can get innaccurate data up to several minutes ago, or worst? Or, is it just within some fractions of a second?
Michel,
In all likelyhood you're using automatic transactions currently, with no or little chance that an update, delete or insert is rejected.
In this situation the chance of NOLOCK returning records of transactions that are not completed is about zero.
The NOLOCK hint is one that is frequently overlooked. For statistical purposes there is seldom a reason not to use it. Unless you're trying to run a long lasting query in an mission critical OLTP environment it does not hurt to set it off. For most applications (such a disconnected web applications) it is not mission critical that a query ones in a few thousand queries might contain a record that was updated, deleted or inserted during the query execution. If the query is on a flat table (not querying on primarykeys - forreign keys relationship) it does not pose a problem either.
Only in certain situations where for example in a transaction the parent was deleted, but the child not yet or the parent was inserted but not all the childs yet, the query would return inaccurate results if executed when those transactions are executing in parrallel.
HTH,
Walter,
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement