Selecting without Locking the table
suggest changeSometimes when tables are used mostly (or only) for reads, indexing does not help anymore and every little bit counts, one might use selects without LOCK to improve performance.
SQL Server
SELECT * FROM TableName WITH (nolock)
MySQL
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM TableName;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
Oracle does not implement READ UNCOMMITTED. Its weakest isolation level is READ COMMITTED.
DB2
SELECT * FROM TableName WITH UR;
where UR stands for “uncommitted read”.
A read that allows uncommitted data can return rows that are later rolled back. The SQL Server hint NOLOCK is not portable.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents