This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of an old stone bridge still open with a new footbridge beside it with a vermilion rail

Create an Index Online in SQL Server: What ONLINE = ON Locks

November 16, 2019
Pinal Dave
SQL Performance
SQL Index, SQL Lock, SQL Scripts, SQL Server

To create an index online in SQL Server, add WITH (ONLINE = ON) to CREATE INDEX, and writers keep working while the index builds. This post compares a plain build with an online build on a three million row table, measures what each one blocks and what the online build costs, and shows where it still waits.

Read More
A signalman's hand passing a brass single-line token in a hoop to a train driver's gloved hand.

Application Locks With sp_getapplock: One Job at a Time

November 15, 2019
Pinal Dave
SQL Tips and Tricks
SQL Lock, SQL Server, SQL Server Agent, SQL Stored Procedure, SQL Transactions

Use sp_getapplock to serialize a job, compare transaction and session ownership, handle return codes, and inspect a two-session test.

Read More
A bike rack with one long red chain looped through every slot while a cyclist waits with nowhere to park

Counting Locks per Session With sys.dm_tran_locks

September 13, 2019
Pinal Dave
SQL Performance
SQL DMV, SQL Lock, SQL Server, SQL Transactions

Count locks per session by resource and mode, connect open transactions, and recognize escalation while keeping snapshot limits clear.

Read More
Gouache painting of a garden hose with a kink held by a vermilion clip and a sputtering sprinkler beyond

Query Runs Slow Occasionally: Five Checks to Find Why

September 7, 2019
Pinal Dave
SQL Performance
Maintenance Plan, SQL Lock, SQL Scripts, SQL TempDB, SQL Wait Stats

When a query runs slow occasionally, the cause sits around the query: a lock, a job, a file growth, tempdb or a shortage of worker threads. This post gives one tested T-SQL check for each and a small demo for blocking and file growth. It also says what to do when all five checks find nothing.

Read More
Gouache painting of a row of fruit baskets, three covered and clasped and one open vermilion basket of peaches

READPAST Query Hint: Skip Locked Rows in SQL Server

August 31, 2019
Pinal Dave
SQL Tips and Tricks
Query Hint, SQL Lock, SQL Scripts, SQL Transactions

The READPAST query hint makes a read skip rows that another transaction has locked, instead of waiting for them. This post builds a five-seat demo, runs it in two windows and lists the cases where the hint does nothing. It also shows the work queue pattern that pairs READPAST with UPDLOCK.

Read More
An open garden gate allows passage while sturdy braces keep its frame stable

Does NOLOCK Really Applies No Lock? – Interview Question of the Week #209

January 20, 2019
Pinal Dave
SQL Interview Questions and Answers
Query Hint, Schema, SQL Lock, SQL Scripts, SQL Server

Does NOLOCK really applies no lock? No. NOLOCK takes a Sch-S, or schema stability, lock. Here is a simple script to see it for yourself.

Read More
A red wheelbarrow stopped across a garden path with three more wheelbarrows waiting behind it

Diagnosing Blocking Chains With sys.dm_exec_requests

December 12, 2018
Pinal Dave
SQL Performance
DBA, SQL DMV, SQL Lock, SQL Performance, SQL Wait Stats

Trace blocking chains from active requests to a candidate head session, inspect sleeping transactions, and verify the owner before action.

Read More
Previous 1 2 3 4 5 6 … 10 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com