In this video, I delve into performance tuning top and percent queries-a topic that might not come up frequently in your SQL Server work but is crucial when it does. We explore how to optimize these queries by using common indexes effectively and introduce a clever technique involving Common Table Expressions (CTEs) or derived tables to significantly improve query performance. By showing you practical examples, I demonstrate the difference between parameterized and literal values and why using CTEs can make your top percent queries much faster. Additionally, I share some insights on how this pattern applies in real-world scenarios, especially when dealing with large datasets. Whether you're a consultant like me or just looking to enhance your SQL Server skills, there's plenty here to help you tackle these challenging queries more efficiently.
CHAPTERS
00:00:00 - Introduction and Setup
00:03:25 - Top Percent Query Performance Issues
00:06:49 - Store Procedure Solution
00:09:18 - Execution Results Comparison
00:12:39 - Handling High Row Counts
00:15:20 - Conclusion and Final Thoughts
━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 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
━━━━━━━━━━━━━━━━━━━━━━━━━━