SQL Server
SQL Server is the Microsoft stack's relational engine, with its own T-SQL dialect, clustered index model, row-versioning isolation and Always On availability.
on this pageshowhide
explore
- T-SQL Dialect6 questions
- Clustered & Columnstore Indexes6 questions
- Procedures & User Functions6 questions
- Locking & Row Versioning6 questions
- Plans & Wait Statistics6 questions
- Always On & Backups6 questions
questions
page 2 of 2In SQL Server, what triggers lock escalation, what does it escalate to, and which of ROWLOCK, LOCK_ESCALATION or batching actually prevents it?
basics
~20 sWhen a statement holds 5,000 locks on one table reference or lock memory passes a threshold, SQL Server swaps them for one table or partition lock, never a page lock. ROWLOCK doesn't prevent it; smaller batches or LOCK_ESCALATION do.
What does optimized locking in SQL Server 2025 change about how UPDATE and DELETE hold locks, and what must a database have enabled first?
basics
~20 sOptimized locking replaces row and page locks held until commit with one exclusive lock on the transaction ID, releasing each row lock once the row is changed. It requires accelerated database recovery; with READ_COMMITTED_SNAPSHOT, rows also qualify without U locks.
Why can a SQL Server MERGE upsert fail with duplicate-key errors under concurrency, and what do HOLDLOCK and OUTPUT $action add?
basics
~20 sUnder default READ COMMITTED, two sessions can both find a new key missing and both insert it; one fails with Msg 2627 or 2601. WITH (HOLDLOCK) applies SERIALIZABLE to the target so the second waits, and OUTPUT $action names each row's action.
How would you design SQL Server high availability and disaster recovery for a payments database that must survive losing a datacenter with at most seconds of data loss?
basics
~20 sUse an availability group with synchronous, automatic-failover replicas in the main datacenter and an asynchronous replica in the second, place cluster quorum so one site's loss is survivable, and keep log backups or delayed log shipping, because replicas copy mistakes too.
After moving a fleet to SQL Server 2025, how would you decide when to raise each database's compatibility level, and what role should Query Store play?
basics
~20 sUpgrade the engine but leave each database at its old compatibility level, enable Query Store and baseline a business cycle, then raise levels in risk order, forcing known good plans for regressions and keeping a rollback path.
You own a busy SQL Server OLTP database whose reports block writers; how do you decide whether to turn on READ_COMMITTED_SNAPSHOT for the whole database, and roll it out?
basics
~20 sREAD_COMMITTED_SNAPSHOT changes every READ COMMITTED reader at once: reader-writer blocking disappears, but code that relied on blocking reads can act on stale data, and versions cost row space and store capacity. Audit that code and size the store first.
showing 31–36 of 36