Online Class • Next Lesson
In this lesson, you will learn how SQL Server is built under the hood and why architecture knowledge is a performance
superpower. Once you understand how data is stored, read, cached, and executed, you stop guessing and start tuning with precision.
This class connects “what SQL Server is doing” to “why your queries are slow” in a practical, DBA-ready way.
SQL Server performance tuning becomes much easier when you understand the database architecture.
This lesson focuses on the components that impact speed the most: the storage engine, the query processor,
memory (buffer pool), transaction log, TempDB, and execution pipeline.
Every slow query is slow for a reason. Usually, it’s doing one (or more) of these:
reading too much data, waiting on locks, waiting on storage,
using too much CPU, or spilling to TempDB. Understanding architecture helps you identify which one.
60–90 minutes (architecture walkthrough + demo + short lab)
SQL Server has two major “brains”: the Query Processor and the Storage Engine.
Performance tuning is often about figuring out which side is causing the delay.
Key teaching point: Execution plans show the strategy, but performance comes from what the storage engine
must physically do (how many pages it reads, how long it waits, and whether it gets blocked).
SQL Server stores table and index data in 8 KB pages. Pages are grouped into extents.
When a query reads data, it is reading pages — not “rows.” This is why the most important tuning metric is often
logical reads.
Key teaching point: A query is “slow” because it reads too many pages, waits too long to read pages,
or gets blocked while trying to access pages.
SQL Server tries to keep frequently accessed pages in memory (the buffer pool). If the page is in memory,
the engine uses it immediately (fast). If it isn’t, SQL Server must fetch it from disk (slow), which increases I/O waits.
Rule of thumb for beginners: If you reduce logical reads, you usually reduce CPU and I/O pressure
and improve performance under concurrency.
SQL Server is a transactional database. Transactions provide correctness, but they also create waiting:
locks (who can access data) and log writes (durability). Many production “slowdowns” are not CPU problems — they’re
blocking problems.
Key teaching point: A query can be “slow” even if it uses almost no CPU — because it’s waiting on a lock.
You must learn to identify “work” vs “waiting.”
TempDB is a shared system database used for temporary work. Many operations become slow when they spill to TempDB,
especially under concurrency. If TempDB is misconfigured or overloaded, the whole instance can slow down.
Key teaching point: TempDB issues often show up as “random slowness” during busy hours.
Understanding TempDB helps you diagnose sorting, hashing, and concurrency pressure correctly.
Demo goal: show students how a simple query touches multiple architectural components (plan selection, memory usage, reads, and waiting).
In your walkthrough, focus on: logical reads, physical reads, and what the plan is forcing SQL Server to do.
Use this to teach students that architecture is measurable (memory, files, and reads).
-- Server start time + core info (architecture context) SELECT sqlserver_start_time, cpu_count, scheduler_count, physical_memory_kb/1024 AS physical_memory_mb FROM sys.dm_os_sys_info; -- Database files (data vs log) - where the pages and log live SELECT DB_NAME(database_id) AS database_name, name AS logical_name, type_desc, physical_name, (size*8)/1024 AS size_mb FROM sys.master_files ORDER BY database_name, type_desc;
Students will capture a simple architecture snapshot and explain what it means in plain English.
This builds confidence and prepares students for indexing and execution plan lessons.
Lab script (safe, read-only):
-- Lab: architecture snapshot (safe) SELECT GETDATE() AS captured_at; SELECT sqlserver_start_time, cpu_count, scheduler_count, physical_memory_kb/1024 AS physical_memory_mb FROM sys.dm_os_sys_info; SELECT DB_NAME(database_id) AS database_name, name AS logical_name, type_desc, physical_name, (size*8)/1024 AS size_mb FROM sys.master_files ORDER BY database_name, type_desc;
Prompt:
“Why might the same query be fast at 2:00 AM but slow at 9:00 AM? In your answer, mention at least one architecture factor
(memory, I/O, locks, TempDB, plan choice, concurrency).”
In the next lesson, we will move into SQL Server Indexing. Indexing is the most common performance lever in SQL Server,
but it only makes sense after you understand how SQL Server stores and reads pages. Once the architecture is clear, indexing becomes logical,
not guesswork.
Not a member yet? Register now
Are you a member? Login now