In this video, I share a humorous and somewhat unconventional query tuning trick that I had to use while working on a client's project. The issue revolved around a simple query that was running quite slow due to an excessive table spool in the execution plan. Despite trying various methods, including trace flags and hints, I found myself stuck until I stumbled upon what seemed like a silly solution: converting one of the columns from its original data type to Envarkar max. This seemingly absurd change surprisingly resolved the problem, drastically reducing the query's runtime by about 4x. While this trick might not work in every situation, it offers an alternative for those who are hesitant to use certain hints or trace flags that some experts consider too advanced. If you enjoyed this lighthearted look at SQL Server query tuning and found it amusing, please like the video and subscribe to my channel for more insights into performance optimization and other interesting topics in SQL Server.
CHAPTERS
00:00:00 - Introduction
00:00:29 - Missing Index Issue
00:01:00 - Table Spool Problem
00:01:28 - Query Performance Analysis
00:02:15 - No Performance Spool Hint
00:02:43 - Extreme Measures Taken
00:03:22 - Query Modification
00:03:56 - Max Data Type Impact
00:04:33 - Situational Solution
00:05:30 - Conclusion
━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 TRAINING & COURSES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Get AI-Ready With Erik
https://training.erikdarling.com/get-...
SQL Server Performance Engineering Course
https://training.erikdarling.com/sql-...
Learn T-SQL with Erik
https://training.erikdarling.com/lear...
Everything Bundle:
https://training.erikdarling.com/?cou...
━━━━━━━━━━━━━━━━━━━━━━━━━━
🛠️ CONSULTING & SERVICES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Need SQL Server performance help?
https://training.erikdarling.com/sqlc...
━━━━━━━━━━━━━━━━━━━━━━━━━━
💬 CONNECT
━━━━━━━━━━━━━━━━━━━━━━━━━━
Ask questions at Office Hours
https://erikdarling.com/officehours/
Become a channel member
/ @erikdarlingdata
━━━━━━━━━━━━━━━━━━━━━━━━━━