SQL Server Page Structure and Transaction Log Architecture Explained

SQL Server Page Structure and Transaction Log Architecture Explained

Lesson 1 covered how SQL Server manages memory and CPU. This lesson covers the physical layer underneath both: how data is actually laid out on disk, and how every single change — no matter how it got there — is guaranteed durable before it’s ever considered committed.

Pages, Extents & the Log, sketched out1 Extent = 8 contiguous pages (64KB)P0P1P2P3P4P5P6P7P3 = 8KB, only ~8060 bytes usableafter the page header + row offsets1. Write to the LOG firstthe change is recorded before anything else moves2. THEN modify the data pagethe actual 8KB page changes on disk3. COMMIT — only once durablethis is literally Durability (the “D” in ACID)A DELETE touching 1,000,000 rows =1,000,000 log records, row-by-row —no matter how fast the disk is. 📌

Pages and Extents

One Extent = 8 contiguous pages (64KB) Page 0 Page 1 Page 2 Each page: 8KB, ~8060 bytes usable after header/row offsets A row larger than one page → row-overflow or LOB storage

This 8KB figure isn’t arbitrary trivia — it’s the exact unit Chapter 4’s STATISTICS IO “logical reads” count is measured in. When that number reports 500 logical reads, it means 500 8KB pages were touched — tying this architecture lesson directly to a diagnostic number you’ll read constantly for the rest of this course.

The Transaction Log: Write-Ahead Logging

-- Check log space usage — a classic "why is my log huge" starting point
DBCC SQLPERF(LOGSPACE);

-- Check log file growth/autogrowth settings
SELECT name, size/128 AS size_mb, growth, is_percent_growth
FROM sys.database_files
WHERE type_desc = 'LOG';

SQL Server uses Write-Ahead Logging (WAL): a change is written to the transaction log before the data page itself is modified on disk, and a transaction is only considered committed once its log record is durably written. This is literally how Durability (the “D” in ACID from the Developers & DBAs course) is implemented — not a separate feature, but the mechanism underneath it.

Why Log Architecture Explains Real Symptoms

A transaction log that won’t shrink, a database stuck in “log full” errors during a bulk load, a mysteriously slow bulk delete — these all trace back to how logging works: every logged operation, including large deletes, must be written to the log before it’s considered durable, row by row. A DELETE affecting a million rows generates roughly a million log records, regardless of how fast the actual data-page changes would otherwise be.

Common mistake: Assuming a slow DELETE is an indexing problem. If the WHERE clause is already using a good index but the operation still crawls, the transaction log — not the index — is very often the actual bottleneck, because of exactly this row-by-row logging requirement. Understanding this now sets up exactly the diagnostic instinct you’ll need for Module 3’s “13-Hour Delete” case study, where this precise trap is the twist.
Practice tip: Run DBCC SQLPERF(LOGSPACE) now, note your practice database’s current log size and percent used, then re-run it after inserting a few thousand synthetic rows in one transaction. Watching the log grow in response to a bulk operation, rather than just reading that it does, is what makes Module 3’s case study land correctly when you get there.

Enjoyed this?

Subscribe to get every new lesson as soon as it’s published, and share it with a developer who’d find it useful.

📡 Subscribe via RSS  | 
Share on X  | 
Share on LinkedIn  | 
Share on Facebook

Want the full structured course with quizzes and hands-on labs? Check out SQL Server Performance Tuning, coming soon on this site.