patternsqlMinor
SQL Server - Bulk load blocking queries on heaps
Viewed 0 times
sqlbulkblockingloadserverqueriesheaps
Problem
SQL Server books online say in SET TRANSACTION ISOLATION LEVEL:
"Optimized bulk load operations on heaps block queries that are running under the following isolation levels:
SNAPSHOT
READ UNCOMMITTED
READ COMMITTED using row versioning".
What does optimized bulk load mean here exactly?
"Optimized bulk load operations on heaps block queries that are running under the following isolation levels:
SNAPSHOT
READ UNCOMMITTED
READ COMMITTED using row versioning".
What does optimized bulk load mean here exactly?
Solution
Optimized bulk load means SQL Server is using a special bulk load code path (fast load) and minimal logging.
These concepts are described in:
From that last link:
Although readers under RCSI are not affected by X locks, there are two bulk load situations that will block RCSI queries (as well as NOLOCK queries) in SQL Server 2008:
These concepts are described in:
- SQL Server 2016, Minimal logging and Impact of the Batchsize in bulk load operations
- Prerequisites for Minimal Logging in Bulk Import
- The Data Loading Performance Guide
From that last link:
Although readers under RCSI are not affected by X locks, there are two bulk load situations that will block RCSI queries (as well as NOLOCK queries) in SQL Server 2008:
- When populating a heap with TABLOCK using BULK INSERT, INSERT-SELECT, or other bulk load operations. This is because the heap load acquires a BULK OPERATION intent exclusive (IX) lock and the NOLOCK or RCSI readers acquire a BULK OPERATION shared (S) lock. To bulk load a heap and permit concurrent readers even using RCSI or NOLOCK, you must eliminate the TABLOCK hint and thus give up minimal logging.
Context
StackExchange Database Administrators Q#220570, answer score: 6
Revisions (0)
No revisions yet.