liveBook · Manning

Table lock

As explained in 100 SQL Server Mistakes and How to Avoid Them

A table lock is a database lock held at table scope that restricts concurrent access to the locked table.

A table lock is a table-scoped restriction used during an SSIS OLE DB fast-load operation. For a flat staging-table load, enabling it avoids contention and reduces lock-escalation overhead. section 6.2

Flat-file load into a staging table

A staging table without keys, constraints, or NULL constraints can use the table-lock option without needing to tune those constraint-related settings. If constraints exist, enabling them can impose a performance penalty, so test the complete load configuration with realistic data. section 6.2

Apply the setting alongside batch and transaction choices:

  • Configure maximum batch size and commit size rather than loading all rows in one transaction, which can increase TempDB use and fill the transaction log. section 6.2
  • Test multiple buffer and batch sizes; the best value depends on the environment, resources, workload, and data profile. section 6.2

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Explains the setting’s performance rationale and related batch choices, but does not detail lock mechanics or concurrency semantics.
Examples
Uses a flat-file data flow loading an unconstrained staging table and compares buffer and batch sizes through performance tests.
What it assumes
Assumes familiarity with SSIS data flows, OLE DB destinations, staging tables, and basic transaction settings.
What you can do after
Operate/configure OLE DB fast-load settings and test table-lock, batch, and commit choices for a staging load.
How it connects
Connects table locks with OLE DB fast load, staging tables, lock escalation, constraints, batching, and transaction commits.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.