Sql-server – JDBC Read uncommitted in SQL Server

lockingsql server

If I set the jdbc isolation level to read uncommitted in SQL Server, will SQL Server ever lock any tables, pages, rows etc?

Thanks.

Best Answer

Read uncommitted from Books Online:

Implements dirty read, or isolation level 0 locking, which means that no shared locks are issued and no exclusive locks are honored. When this option is set, it is possible to read uncommitted or dirty data; values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. This option has the same effect as setting NOLOCK on all tables in all SELECT statements in a transaction. This is the least restrictive of the four isolation levels.

So no it doesn't lock tables, rows or pages. However, any SELECT (even with READ UNCOMMITTED set) will issue a Sch-S (schema stability) lock, which basically means no schema changes can happen while the SELECT is executing (schema changes = add/drop column, change datatype of a column, change nullability of a column and a couple other operations I can't think of off the top of my head). A Sch-S lock should not interfere with DML statements (SELECT/INSERT/UPDATE/DELETE).