Synopses & Reviews
Tackle the toughest set-based querying and query tuning problems—guided by an author team with in-depth, inside knowledge of T-SQL. Deepen your understanding of architecture and internals—and gain practical approaches and advanced techniques to optimize your code’s performance.
Discover how to:
- Move from procedural programming to the language of sets and logic
- Optimize query tuning with a top-down methodology
- Assess algorithmic complexity to predict performance
- Compare data-aggregation techniques, including new grouping sets
- Manage data modification—insert, delete, update, merge—for performance
- Write more efficient queries against partitioned tables
- Work with graphs, trees, hierarchies, and recursive queries
- Plus—Use pure-logic puzzles to sharpen your problem-solving skills
Comprehensive hands-on reference focuses on advanced querying techniques using Transact-SQL (T-SQL). For database developers & adminstrators. Includes code & table examples.
About the Author
Itzik Ben-Gan is a principal mentor and a founder of SolidQ. A Microsoft MVP for SQL Server since 1999, Itzik teaches and consults internationally on T-SQL querying, programming, and query tuning. He has written numerous articles for SQL Server Magazine and MSDN, and speaks at industry events such as Microsoft TechEd, DevWeek, PASS, and SQL Server Connections.
Lubor Kollar is group program manager with the SQL Server Customer Advisory Team at Microsoft, working on the most challenging SQL Server deployments worldwide. He has 13+ years of experience with SQL Server development.
Dejan Sarka is a mentor with SolidQ and focuses on development of database and business intelligence applications. He is a frequent speaker at international conferences such as TechEd, SqlDevCon, and PASS. He is the founder of the Slovenian SQL Server and .NET Users Group. As main author or coauthor, Dejan has written nine books about SQL Server. He has also developed three courses for SolidQ: Data Modeling Essentials, Data Quality and Master Data Management, and Data Mining.
Steve Kass, PhD, is an MVP for SQL Server and a professor of mathematics and computer science. He has written for SQL Server Magazine and spoken at SQL Server Magazine Connections events.
Table of Contents
Foreword; Acknowledgments; Introduction; Hardware and Software Requirements; Companion Content and Sample Database; Find Additional Content Online; Support for These Books; Chapter 1: Logical Query Processing; 1.1 Logical Query Processing Phases; 1.2 Sample Query Based on Customers/Orders Scenario; 1.3 Logical Query Processing Phase Details; 1.4 Further Aspects of Logical Query Processing; 1.5 Conclusion; Chapter 2: Set Theory and Predicate Logic; 2.1 An Example of English-to-Mathematics Translation; 2.2 Set Theory; 2.3 Predicate Logic; 2.4 Relations; 2.5 A Practical Application; 2.6 Conclusion; Chapter 3: The Relational Model; 3.1 Introduction to the Relational Model; 3.2 Relational Algebra and Relational Calculus; 3.3 Data Integrity; 3.4 Normalization and Other Design Topics; 3.5 Conclusion; Chapter 4: Query Tuning; 4.1 Sample Data for This Chapter; 4.2 Tuning Methodology; 4.3 Tools for Query Tuning; 4.4 Index Tuning; 4.5 Preparing Sample Data; 4.6 An Examination of Set-Based vs. Iterative/Procedural Approaches and a Tuning Exercise; 4.7 Conclusion; Chapter 5: Algorithms and Complexity; 5.1 Do You Have a Quarter?; 5.2 How Algorithms Scale; 5.3 Classic Algorithms and Algorithmic Strategies; 5.4 A Practical Application; 5.5 Conclusion; Chapter 6: Subqueries, Table Expressions, and Ranking Functions; 6.1 Subqueries; 6.2 Table Expressions; 6.3 Analytical Ranking Functions; 6.4 Auxiliary Table of Numbers; 6.5 Missing and Existing Ranges (Also Known as Gaps and Islands); 6.6 Conclusion; Chapter 7: Joins and Set Operations; 7.1 Joins; 7.2 Set Operations; 7.3 Conclusion; Chapter 8: Aggregating and Pivoting Data; 8.1 OVER Clause; 8.2 Tiebreakers; 8.3 Running Aggregations; 8.4 Pivoting; 8.5 Unpivoting; 8.6 Custom Aggregations; 8.7 Histograms; 8.8 Grouping Factor; 8.9 Grouping Sets; 8.10 Conclusion; Chapter 9: TOP and APPLY; 9.1 SELECT TOP; 9.2 APPLY; 9.3 Solutions to Common Problems Using TOP and APPLY; 9.4 Logical Transformations; 9.5 Conclusion; Chapter 10: Data Modification; 10.1 Inserting Data; 10.2 Deleting Data; 10.3 Updating Data; 10.4 Merging Data; 10.5 OUTPUT Clause; 10.6 Conclusion; Chapter 11: Querying Partitioned Tables; 11.1 Partitioning in SQL Server; 11.2 Conclusion; Chapter 12: Graphs, Trees, Hierarchies, and Recursive Queries; 12.1 Terminology; 12.2 Scenarios; 12.3 Iteration/Recursion; 12.4 Materialized Path; 12.5 Materialized Path with the HIERARCHYID Data Type; 12.6 Nested Sets; 12.7 Transitive Closure; 12.8 Conclusion; Appendix A: Logic Puzzles; Puzzles; Puzzle Solutions; Conclusion; About the Authors; Itzik Ben-Gan; Lubor Kollar; Dejan Sarka; Steve Kass;