Concurrent Upserts in SQL Server Without the Existence Race
Protect insert-or-update operations with unique keys, transaction-scoped range locks, explicit replacement semantics, and retries that respect commit outcomes.
Read articlePractical articles about ClickHouse, SQL Server, analytics architecture, performance, migration, and database operations.
Protect insert-or-update operations with unique keys, transaction-scoped range locks, explicit replacement semantics, and retries that respect commit outcomes.
Read articleThe optimizer chooses joins, access methods, and memory grants from estimated row counts. When estimates diverge from reality, a reasonable plan can become expensive.
Read articleReturn generated keys and before/after values with OUTPUT while handling ordering, triggers, transaction failure, and retry correlation.
Read articleUse interval deltas instead of lifetime wait totals, recognize counter resets, and connect SQL Server waits to the requests users actually experience.
Read articleAvoid integer division, intermediate overflow, and inconsistent invoice totals by choosing SQL Server numeric types and rounding rules deliberately.
Read articleBuild an atomic queue claim, understand READPAST limits, and recover abandoned work without allowing stale workers to overwrite new owners.
Read articleTempDB supports sorts, hashes, row versioning, temporary objects, spills, and internal worktables. Poor layout or slow storage can turn it into a shared bottleneck.
Read articleRecognize join fanout, aggregate each child table at the intended grain, and avoid DISTINCT fixes that produce plausible but incorrect report totals.
Read articleUse file-level counter deltas to investigate current I/O latency, distinguish data and log behavior, and avoid misleading lifetime averages.
Read articleUse sp_getapplock to coordinate competing workers, handle return codes correctly, and keep lock scope separate from durable idempotency.
Read articleA deadlock is a cycle in which sessions hold resources needed by one another. SQL Server terminates one participant, but the victim is not necessarily the root cause.
Read articleBuild reliable SQL Server pagination with a unique sort order, a matching index, stable cursors, and explicit rules for concurrent changes.
Read article