Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
SQL Server Query Tuning and Optimization

You're reading from  SQL Server Query Tuning and Optimization

Product type Book
Published in Aug 2022
Publisher Packt
ISBN-13 9781803242620
Pages 446 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Benjamin Nevarez Benjamin Nevarez
Profile icon Benjamin Nevarez

Table of Contents (14) Chapters

Preface 1. Chapter 1: An Introduction to Query Tuning and Optimization 2. Chapter 2: Troubleshooting Queries 3. Chapter 3: The Query Optimizer 4. Chapter 4: The Execution Engine 5. Chapter 5: Working with Indexes 6. Chapter 6: Understanding Statistics 7. Chapter 7: In-Memory OLTP 8. Chapter 8: Understanding Plan Caching 9. Chapter 9: The Query Store 10. Chapter 10: Intelligent Query Processing 11. Chapter 11: An Introduction to Data Warehouses 12. Chapter 12: Understanding Query Hints 13. Other Books You May Enjoy

Getting plans from a trace or the plan cache

So far, we have been testing getting execution plans by directly using the query code in SQL Server Management Studio. However, this method may not always produce the plan you want to troubleshoot or the plan creating the performance problem. One of the reasons for this is that your application might be using a different SET statement option than SQL Server Management Studio and producing an entirely different execution plan for the same query. This behavior, where two plans may exist for the same query, will be covered in more detail in Chapter 8, Understanding Plan Caching.

Because of this behavior, sometimes, you may need to capture an execution plan from other locations, for example, the plan cache or current query execution. In these cases, you may need to obtain an execution plan from a trace, for example, using SQL trace or extended events, or the plan cache using the sys.dm_exec_query_plan dynamic management function (DMF) or...

You have been reading a chapter from
SQL Server Query Tuning and Optimization
Published in: Aug 2022 Publisher: Packt ISBN-13: 9781803242620
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}