Tag: Azure SQL

  • Memory-Optimized TempDB Metadata and Azure SQL Performance Specifics

    Memory-Optimized TempDB Metadata and Azure SQL Performance Specifics

    Two focused topics to close out the course: a direct engine-level fix for Module 5’s tempdb contention, and what genuinely changes when your target isn’t on-prem SQL Server anymore.

    Two ways the ground shifts under you(an engine fix, and a platform)TEMPDB METADATAbefore: PAGELATCH_EX pileup evenon the SYSTEM CATALOG pagesMEMORY_OPTIMIZEDTEMPDB_METADATA = ONlock & latch-free — even the catalog ✓+ON AZURE SQL DATABASExProfiler — gone, use XEventsxResource Governor — not availablextempdb files — managed for youEvidence-First workflow — identicalNote: Azure SQL Managed Instance sits in between —more on-prem surface than Azure SQL Database, stillless than a true on-prem or IaaS VM install. 📌

    Memory-Optimized TempDB Metadata: The Modern Fix

    ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA = ON;
    -- Requires a service restart to take effect

    Rather than just spreading GAM/SGAM/PFS contention across multiple files (Module 5’s fix), this moves tempdb’s system tables and metadata structures themselves into lock/latch-free memory-optimized structures — directly eliminating the contention at its source rather than diluting it. Available since SQL Server 2019; genuinely the better long-term answer where supported.

    What Actually Changes on Azure SQL Database

    Concept from this course Azure SQL Database difference
    Buffer pool / memory (Module 1) Sized by your chosen service tier/vCore, not physical server RAM you control directly
    SQL Server Profiler Not available — Extended Events (Module 6) is the only option, which is exactly why this course taught XEvents thoroughly
    Resource Governor Not available on single/elastic pool databases — workload isolation instead comes from service tier/DTU-vCore choice itself
    tempdb file configuration Managed automatically — you don’t configure files directly

    Azure SQL Managed Instance sits in between: it supports far more of the on-prem surface (including SQL Agent, cross-database queries, and more configuration control) than Azure SQL Database, but still abstracts some infrastructure-level tuning compared to a true on-prem or IaaS VM install.

    The Takeaway for This Whole Course

    Every diagnostic principle — Evidence-First, SARGability, execution plans, DMVs, Query Store — applies identically on Azure. What changes is which infrastructure-level levers (Resource Governor, tempdb files, Profiler) are available to you versus abstracted away by the platform.


    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.

  • Creating a SQL Server Database on Azure SQL and AWS RDS: A Beginner’s PaaS Guide

    Creating a SQL Server Database on Azure SQL and AWS RDS: A Beginner’s PaaS Guide

    Every option in the last lesson — Developer Edition, Docker, Express — means you install and manage SQL Server. A huge share of real jobs instead use a managed (PaaS) SQL Server, where the cloud provider runs the engine for you. Here’s what that actually looks like, and why it’s worth understanding even as a beginner — you may well connect to one of these on your very first day at a job.

    Who Manages What?(on-prem vs IaaS vs PaaS)this lesson →On-PremYour DatabaseSQL Server EngineOperating SystemHardwareIaaS (VM)Your DatabaseSQL Server EngineOperating SystemHardwarePaaS (Managed)Your DatabaseSQL Server EngineOperating SystemHardware= you manage= provider managesAzure & RDS block ALLIPs by default — evenyours. Add a firewallrule before you connect.

    IaaS vs PaaS vs On-Prem — Where Each Fits

    It helps to place “managed SQL” on a spectrum rather than treat it as one thing:

    • On-prem / local install (what Chapter 0.3 covered) — you own the hardware, the OS, and the SQL Server installation. Maximum control, maximum responsibility.
    • IaaS (e.g. a SQL Server VM on Azure/AWS/GCP) — the cloud provider gives you a virtual machine; you still install and manage SQL Server on it yourself, same as local, just on someone else’s hardware.
    • PaaS (Azure SQL Database, AWS RDS for SQL Server) — the provider manages the SQL Server engine itself. You get a connection string, not a server to log into.

    This lesson is specifically about the third option, since it’s the one most beginners haven’t seen and the one most likely to surprise you in a real job (“why can’t I just RDP into the database server?” — because there isn’t one you can access).

    What “PaaS” Changes

    You installed it (Ch. 0.3) You patch, back up, and size the hardware yourself Full OS/file access Azure SQL / RDS (PaaS) Provider patches, backs up, and handles HA automatically You connect with SSMS — no OS access

    You still write the exact same T-SQL you’ve been learning. What changes is everything around the database — how it’s created, connected to, secured, and maintained.

    Creating a Database on Azure SQL

    1. In the Azure Portal, search for SQL DatabaseCreate
    2. Choose or create a logical server (a management boundary and connection endpoint, not a physical machine — one logical server can host many databases) — set an admin login and password here
    3. Pick a pricing tier: DTU-based (simpler, bundled compute+storage+IO into one number, good for beginners) or vCore-based (separately configurable compute/storage, closer to how you’d think about a VM’s specs, and the tier Microsoft is steering customers toward long-term)
    4. Under Networking, add your current IP to the firewall rule so you can actually connect — by default, Azure SQL blocks every IP, including yours, until explicitly allowed
    5. Click Create — provisioning takes a few minutes
    -- Connect via SSMS using the server's full name, e.g.:
    -- Server: yourserver.database.windows.net
    -- Authentication: SQL Server Authentication, using the admin login you set
    
    SELECT @@VERSION; -- confirms you're connected, same as any other SQL Server

    Creating a Database on AWS RDS for SQL Server

    1. In the AWS Console, go to RDSCreate database
    2. Choose engine: Microsoft SQL Server, pick an edition (Express is free-tier eligible for learning)
    3. Set the DB instance identifier, master username, and password
    4. Under Connectivity, set a Security Group rule allowing inbound traffic on port 1433 from your IP — AWS’s equivalent of Azure’s firewall rule, same underlying idea: nothing gets in until you explicitly allow it
    5. Create — RDS provisions the instance, then gives you an endpoint (hostname) to connect to
    -- Connect via SSMS using the RDS endpoint, e.g.:
    -- Server: yourinstance.abc123xyz.us-east-1.rds.amazonaws.com,1433
    
    CREATE DATABASE TechCorpLite; -- works exactly like it did locally
    GO
    Practical note: Unlike Azure SQL Database (where the “server” is purely logical and databases are created individually), RDS provisions a full DB instance first — conceptually closer to a managed VM running SQL Server — and you then create one or more databases inside it, exactly as shown above.

    What a Beginner Should Actually Know Is Different

    Local / Docker install Azure SQL Database AWS RDS for SQL Server
    You manage backups Automatic, provider-managed, point-in-time restore included Automatic, provider-managed, point-in-time restore included
    Full file system access No file/OS access at all No file access; limited OS-level settings via parameter groups
    Any T-SQL feature works Some features restricted (e.g. cross-database queries on single DBs, SQL Server Agent doesn’t exist — use Elastic Jobs instead) Very close to full on-prem feature set, including SQL Server Agent
    You size the hardware You pick a DTU/vCore tier instead — resizable with minutes of downtime You pick an instance class (like a VM size, e.g. db.t3.medium)
    You control patching schedule Automatic, provider-managed, no maintenance window choice needed for most tiers Automatic, but you choose a maintenance window

    Everything you’ll learn for the rest of this course — SELECT, JOIN, constraints, all of it — works identically once you’re connected. The only thing that changes is how you got connected in the first place, and a short list of admin-level features (cross-database queries, SQL Server Agent, filesystem access) that a beginner course won’t rely on anyway.

    Why This Matters Even If You Never Provision One Yourself

    In most companies, a DBA or platform team provisions the Azure SQL/RDS instance, and you’re handed a connection string. But you’ll still hit PaaS-specific quirks directly: connection timeouts from firewall misconfiguration, “feature X isn’t supported” errors that don’t happen locally, and cost conversations driven by DTU/vCore tier choice. Recognizing “oh, this is a PaaS limitation, not a bug in my query” saves real debugging time — which is exactly why this lesson exists this early in the course, not buried in an advanced chapter.


    Enjoyed this?

    Subscribe to get every new SQL Server 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, projects, and 10+ exercises per chapter? Check out SQL Server Fundamentals, coming soon on this site.

  • Module 7 Quiz: SQL Server Advanced Performance Features (10 Questions)

    Module 7 Quiz: SQL Server Advanced Performance Features

    1. What problem from earlier in this course does In-Memory OLTP most directly address?

    A) Missing indexes
    B) Lock and latch contention under extreme concurrency (Module 5)
    C) Stale statistics
    D) SARGability

    Show Answer

    Answer: B

    Memory-optimized tables use row-versioning and avoid traditional page structures, eliminating the lock/latch mechanisms entirely for those tables.

    2. What makes a natively compiled stored procedure different from a regular one?

    A) No difference at all
    B) It compiles to actual machine code, with a restricted T-SQL surface area
    C) It runs slower but is more flexible
    D) It can only be called from the application tier

    Show Answer

    Answer: B

    The performance ceiling is much higher, but you give up dynamic SQL and other T-SQL features to get it.

    3. Is In-Memory OLTP a good default upgrade for a general-purpose reporting table?

    A) Yes, always upgrade everything
    B) No — it’s best reserved for confirmed extreme-contention scenarios, not a default choice
    C) It’s required for all tables in modern SQL Server
    D) Reporting tables can’t be disk-based

    Show Answer

    Answer: B

    Reach for it only after evidence confirms lock/latch contention is the actual bottleneck — the Evidence-First principle applies here too.

    4. What does a Resource Governor resource pool control?

    A) Disk space quotas only
    B) A capped slice of CPU and memory for a given workload group
    C) User passwords
    D) Backup schedules

    Show Answer

    Answer: B

    Resource pools cap CPU/memory consumption, preventing one workload from starving another sharing the same instance.

    5. What routes an incoming connection to a specific Resource Governor workload group?

    A) The connection string alone
    B) A classifier function evaluated at login
    C) Random assignment
    D) The database name only

    Show Answer

    Answer: B

    The classifier function (e.g. checking SUSER_SNAME()) decides which workload group governs each new session.

    6. Does Resource Governor fix a badly-written, missing-index query?

    A) Yes, it automatically optimizes queries
    B) No — it limits blast radius (CPU/memory cap), it doesn’t fix the query itself
    C) It rewrites the query automatically
    D) It adds missing indexes automatically

    Show Answer

    Answer: B

    It’s a containment guarantee, not a substitute for the actual tuning work from Modules 2-4.

    7. What does enabling memory-optimized tempdb metadata fix, and how does it differ from just adding more tempdb files?

    A) It has the same effect as adding files
    B) It moves tempdb’s system metadata into lock/latch-free structures, eliminating contention at the source rather than spreading it across files
    C) It disables tempdb entirely
    D) It only works on Azure

    Show Answer

    Answer: B

    Multiple files (Module 5) dilute contention; memory-optimized metadata removes the underlying lock/latch mechanism for tempdb system tables entirely.

    8. Is SQL Server Profiler available on Azure SQL Database?

    A) Yes, identical to on-prem
    B) No — Extended Events is the only option there
    C) Only on weekends
    D) Profiler is required, not optional, on Azure

    Show Answer

    Answer: B

    This is exactly why Module 6 taught Extended Events thoroughly — it’s the portable skill across on-prem and Azure SQL Database.

    9. Is Resource Governor available on Azure SQL Database (single/elastic pool)?

    A) Yes, fully available
    B) No — workload isolation instead comes from service tier/compute choice itself
    C) Only for Enterprise Edition
    D) It’s the default behavior with no configuration needed

    Show Answer

    Answer: B

    On Azure SQL Database, the platform abstracts this — your service tier/vCore choice is the isolation mechanism instead.

    10. Do the Evidence-First diagnostic principles from this entire course still apply on Azure SQL Database?

    A) No, Azure requires an entirely different approach
    B) Yes — the diagnostic principles are identical; only which infrastructure-level levers are directly available changes
    C) Only Query Store works on Azure
    D) Azure SQL doesn’t support DMVs

    Show Answer

    Answer: B

    SARGability, execution plans, DMVs, and Query Store all apply the same way — Azure just abstracts some infrastructure control (Resource Governor, tempdb files, Profiler).


    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.