Description:
In this video, I delve into the world of Common Table Expressions (CTEs) in SQL Server, often highlighting their perceived benefits and the reality behind them. I start by addressing a common misconception that CTEs make queries more readable, showing through examples how such claims are misleading at best. The video then dives deep into the technical aspects, explaining why SQL Server's implementation of CTEs is far from ideal, especially in terms of materialization and performance. By walking through various query scenarios, I illustrate the pitfalls of relying on CTEs for complex operations, emphasizing that their utility often lies in workarounds for T-SQL limitations rather than inherent advantages.
CHAPTERS
00:00:00 - Introduction to CTEs and Their Limitations
00:03:27 - Why CTEs Aren't Always the Best Solution
00:05:19 - T-SQL Limitations and Workarounds with CTEs
00:08:46 - Practical Use Cases for CTEs
00:11:22 - Logical Query Processing and Row Number Filtering
00:13:45 - Summary of CTE Usage and Benefits
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? TRAINING & COURSES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Get AI-Ready With Erik
https://training.erikdarling.com/get-ai-ready-with-erik?coupon=AIREADY
SQL Server Performance Engineering Course
https://training.erikdarling.com/sql-server-performance-engineering?coupon=ENGINEERING
Learn T-SQL with Erik
https://training.erikdarling.com/learn-t-sql-with-erik?coupon=ADVANCEDTSQL
Everything Bundle:
https://training.erikdarling.com/?coupon=SPRINGCLEANING
━━━━━━━━━━━━━━━━━━━━━━━━━━
????️ CONSULTING & SERVICES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Need SQL Server performance help?
https://training.erikdarling.com/sqlconsulting
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? CONNECT
━━━━━━━━━━━━━━━━━━━━━━━━━━
Ask questions at Office Hours
https://erikdarling.com/officehours/
Become a channel member
https://www.youtube.com/@ErikDarlingData/join
━━━━━━━━━━━━━━━━━━━━━━━━━━
Share this link via
Or copy link















































