1.

What is Lock escalation in SQL

Answer»

The PERFORMANCE of the SQL query gets improved by NOLOCK as it does not lockup rows so it will not affect reading /processing data from the table. The NOLOCK can be used while dealing with large tables having a million records and with a table where data rarely gets changed. If we have too many locks in SQL then row level locking can be extended to block and even on table level which might stall processing of query till the time operation which acquired lock does not get completed. We can extract COMMITTED and uncommitted data using NOLOCK. This situation may result in dirty read if the system has not been designed to HANDLE such a scenario.

Generally to avoid dirty read we use the TIMESTAMP column which can be referenced while EXECUTING DELETE /UPDATE commands to know if data has been changed or not. This helps us in preventing data changes based on dirty read problem. COMPARING each column values is very  expensive operation so this is the reason industry standard suggest TIMESTAMP column



Discussion

No Comment Found