Topics

Friday, October 17, 2025

Breaking Changes & Migration Risks in SQL Server 2025


Breaking Changes & Migration Risks in SQL Server 2025

Every new SQL Server release comes with shiny features — but SQL Server 2025 brings more than just enhancements. It's important to know that there are several breaking changes under the hood that could futz your upgrade if you’re not paying attention.

The New Reality

SQL Server 2025 marks Microsoft’s biggest structural shift since 2019. Many legacy subsystems are being removed or rewritten to make room for AI-driven query features, better JSON handling, and tighter security boundaries. That progress comes at a cost, especially for older or hybrid environments.

What’s Breaking or Disappearing

  • Hot-Add CPU and Lightweight Pooling. Both are deprecated and no longer supported in 2025.
  • Master Data Services (MDS) and Data Quality Services (DQS). Officially retired; time to look toward Azure Purview or Fabric.
  • Remote Server connections. Linked Server encryption rules now enforce modern TLS by default, breaking many legacy connections.
  • Replication & Log Shipping authentication. May fail under new encryption defaults unless reconfigured with certificates or updated service accounts.
  • Extended stored procedures. Custom DLL calls are now fully blocked; migrate to CLR or external services.

Security & Connectivity Changes

Microsoft has quietly raised the security baseline. If your environment still uses older SQL Native Client providers, you’ll see connection errors after upgrade. The new defaults enforce:

  • TLS 1.2+ only (no fallback)
  • Encrypted channel by default for Linked Servers
  • Hardened credentials in system views

That means every legacy Linked Server, SSIS package, or service account using old OLE DB providers needs to be tested and re-registered. Don’t make the assumption that it's just going to reconnect. It won't.

Collation & Compatibility

Collation rules have evolved again. Unicode normalization is now more aggressive, and Latin1_General_100_CI_AI_SC_UTF8 behaves differently in ordering and comparisons. Even small changes in sort order can break ETL checksums or equality joins when migrating from 2017/2019 builds.

Query Engine Behavior

SQL Server 2025 introduces deeper refinements in the Intelligent Query Processing framework and smarter cost model calibration. These changes continue the trend that began in 2019 and 2022 — giving the optimizer more freedom to adapt to runtime feedback and plan variability. While performance generally improves, some workloads may behave differently as a result of:

  • Re-estimated row counts during parameter-sensitive execution plans (via new IQP features).
  • Reordered joins and aggregations under the updated cardinality model.
  • Deprecated or ignored trace flags that previously influenced join behavior or costing.

SQL Server 2025 also expands the Optional Parameter Plan Optimization (OPPO) feature, which lets the engine build multiple parameter-specific plans for a single query. That can dramatically improve parameter-sniffing stability — but it can also cause unexpected plan shifts compared to previous compatibility levels.

To stay safe: capture baselines in Query Store, compare plan regressions under compatibility level 170, and validate with representative workloads before cutting over to production.

Always test your workload under DBCC TRACEON(3604, 8675) or via Query Store captures before committing. You might very well find that previously stable queries are taking new paths now -- possibly not the right ones!

Migration Risk Checklist

  • ✅ Validate every Linked Server using new TLS policies.
  • ✅ Review replication agents and connection strings.
  • ✅ Rebuild SSIS packages that use older OLE DB drivers.
  • ✅ Test collation-dependent logic and string joins.
  • ✅ Re-benchmark key workloads in compatibility level 170.

Final Thoughts

SQL Server 2025 isn’t a simple “upgrade.” It’s a platform shift toward secure, AI-ready data operations... whether you want them or not.

For DBAs, the best migration plan is simple: know your dependencies, test everything twice, and never assume yesterday’s connection string will work tomorrow.

More to read: Optional Parameter Plan Optimization

Monday, October 13, 2025

Move SQL Server Data Instantly -- ALTER TABLE SWITCH

Use ALTER TABLE ... SWITCH to move very large tables instantly.  Yes.  I said instantly.  ALTER TABLE .. SWITCH doesn't copy the data or physically move it.  It just reassigns the page ownership.  This means that only the metadata with the data pointer changes, and that's why it completes in milliseconds and barely touches the transaction log.

Why DBAs might use SWITCH

  • Replace a bad load (month/year) in seconds.

  • Archive or purge without huge deletes.

  • Make schema changes on large tables like remove IDENTITY property, go from INT to BIGINT, or change compression with zero downtime.

  • Stage and validate offline, then promote instantly.

Requirements

  • Your tables match:   Same columns -- names, order, types, nullability, same indexes clustered and non, same compression, same computed columns, collation, filegroups... everything.  
  • Target table is empty before the SWITCH
  • Foreign Keys / constraints must be compatible (or you can temporarily drop them and recreate afterward)


Example --  To remove IDENTITY column

-- Original table with IDENTITY
CREATE TABLE dbo.Orders
(
OrderID INT IDENTITY(1,1) PRIMARY KEY,
OrderDate DATE NOT NULL,
Amount MONEY NOT NULL
);
 

-- Target clone WITHOUT identity (same shape)
CREATE TABLE dbo.Orders_NoIdentity
(
OrderID INT NOT NULL PRIMARY KEY,
OrderDate DATE NOT NULL,
Amount MONEY NOT NULL
); 

-- Batch copy + wait + watch log file + make dinner + wait longer
INSERT dbo.Orders_NoIdentity (OrderID, OrderDate, Amount)
SELECT OrderID, OrderDate, Amount
FROM dbo.Orders;

          OR 

-- Instant handoff
ALTER TABLE dbo.Orders
SWITCH TO dbo.Orders_NoIdentity; -- completes instantly


Serious.  It is that easy.  I, too, was totally Mrs. Doubtfire the first time I did it on a table with 633,910,472 records.  I kid you not.  It was instant.  I literally jumped in my seat!  Looked around me hoping that someone else might have seen it.  Checking my logs, SELECTing COUNT... I was floored. 

ALTER TABLE ... SWITCH is also regularly used with data partitions.  In fact, that is where I first learned about it years ago, from my very favorite MSFT expert.  She taught me how to manage the RANGE RIGHT partitions quarterly in a rather large OrderEvents database using ALTER TABLE ... SWTICH PARTITION.  Very good, very effective, but I'm just saying that you don't HAVE to have partitions to use this feature.  

You should try this yourself on any table - big or small.  Make sure your source and target table definition matches and your target is empty.  Then watch the magic happen.  Let me know how many rows you 'moved' in less than a second.




Thursday, October 9, 2025

Using AI to Write SQL: What's Real, What's Hype

 "Show me top customers by sales for last quarter."

AI writes the query, formats it, and even adds a comment.  Look at the time you saved!!!  Magic, right?  enh.... Let’s talk about what’s real and what’s hype when it comes to AI writing SQL.















The Promise

AI-Assisted query generation has exploded.  Between Copilot in SSMS, ChatGPT and the new Azure AI Integrations, we're seeing something incredible.  People who don't even speak SQL can now build queries that actually run!

Here’s what AI already does well:
  • Generates boilerplate queries and joins in seconds.
  • Converts English into working T-SQL (ie., 'show me top customers by sales').
  • Suggests filters, aggregations, and window functions.

It’s faster, smarter, and, WHEN GUIDED CORRECTLY, can be remarkably accurate for common requests.

The Reality

We really mustn't forget the most important thing. The part that makes the SQL correct, efficient, usable, safe, even just applicable -- this part still belongs to you. 😉

AI doesn’t:
  • Know your schema or naming conventions.
  • Understand your business rules or data quality quirks.
  • Predict query plan costs, indexes, or blocking risk.
  • Catch logic traps like date overlaps, cardinality mismatches or cartesian joins.

Think of AI like a gifted intern.  Quick with code but you still need to review.

What’s Actually Working

Capability                    Tools                              Strong Use Cases

Friday, October 3, 2025

SQL Server Waits

SQL Server records every moment it spends waiting — on locks, latches, I/O, CPU coordination, memory and network calls. The DMV sys.dm_os_wait_stats is the scoreboard for the wait statistics. This dmv provides details about all waits encountered by executing threads, and it is essential for diagnosing performance issues with SQL Server and specific queries being run.

The only caveat is that the sys.dm_os_wait_stats is crowded with a lot of noise, so you need to filter and prioritize to be sure you are looking at what matters. Here are the waits that consistently give you usable performance insight.

1. Concurrency & Blocking
    LCK_M_% (locks)
    Meaning:  Sessions are blocked waiting on locks.
    Why it matters:  Points to blocking chains, poor indexing, or long transactions.
    Action:  Run blocking queries (XE or sys.dm_exec_requests), shorten 
                transactions, add missing indexes.
 
    PAGELATCH_%
    Meaning:  Latch contention, often in tempdb.
    Why it matters:  Classic sign of tempdb allocation contention.
    Action:  Add multiple equally sized tempdb files (usually 1 per 4 cores up to 
                8), check hot spots.

2. Parallelism
    CXPACKET / CXCONSUMER
    Meaning:  Threads coordinating parallel queries.
    Why it matters:  High values = skew or poor parallelism decisions.
    Action:  Review MAXDOP, update statistics, look at plan skew (one thread 
               does all the work).

3. I/O Bottlenecks
    WRITELOG
    Meaning:  Waiting to flush to the transaction log.
    Why it matters:  Log is bottlenecking throughput.
    Action:  Pre-size logs, fix VLF fragmentation, confirm storage latency, keep log 
               on its own disk/LUN.

    PAGEIOLATCH_%
    Meaning:  Waiting on data file I/O.
    Why it matters:  Points to slow disk or excessive scans.
    Action:  Tune queries, add indexes, check storage latency.

4. Memory Pressure
    RESOURCE_SEMAPHORE
    Meaning:  Queries are waiting for memory grants.
    Why it matters:  Memory-intensive operators (hash joins, sorts) can starve 
                             the system.
    Action:   Add missing indexes, reduce row estimates, break up big queries, or 
                 scale RAM.
    MEMORY_GRANT_PENDING (via XE)
    Meaning:  Same problem, live view.
    Action:  Use sys.dm_exec_query_memory_grants to see offenders.

5. Network & Client
    ASYNC_NETWORK_IO
    Meaning:  SQL is waiting for the client to fetch rows.
    Why it matters:  Not a SQL bottleneck — it’s the app pulling rows too slowly.
    Action:  Fix fetch size, batching, or chatty app design.

6. Ignore the Junk
    Don’t waste time on:
 SLEEP_TASK
 XE_TIMER_EVENT
 BROKER_ waits (unless you use Service Broker)
   
   These inflate totals but tell you nothing about performance. Filter them out 
   when running wait stats queries.

Quick Script: Top Useful Waits

SELECT TOP 10
    wait_type,
    waiting_tasks_count,
    wait_time_ms/1000.0 seconds,
    CAST(100.0 * wait_time_ms / SUM(wait_time_ms) OVER() AS DECIMAL(5,2)) pct
FROM sys.dm_os_wait_stats
WHERE wait_type NOT IN (
    'SLEEP_TASK','BROKER_TASK_STOP','XE_TIMER_EVENT',
    'BROKER_TO_FLUSH','SQLTRACE_BUFFER_FLUSH'
)
ORDER BY wait_time_ms DESC;

 

* Focus on the top 2–3 by percentage, not just raw counts. This is where your users are feeling the pain. *


The sys.dm_os_wait_stats DMV is a very powerful tool for diagnosing SQL Server performance concerns.  Using it can help you to better understand your server's wait statistics and help you to more easily identify bottlenecks and optimize SQL Server's performance.