Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
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

Exploring statistics

SQL Server creates and maintains statistics to allow the Query Optimizer to calculate cardinality estimation. A cardinality estimate is the estimated number of rows that will be returned by a query or by a specific query operation, such as a join or a filter. Selectivity is a concept similar to cardinality estimation, which can be described as the fraction of rows in a set that satisfies a predicate, and it is always a value between 0 and 1, inclusive. A highly selective predicate returns a small number of rows. Rather than say any more on the subject here, we’ll dive into more detail about these concepts later in this chapter.

Creating and updating statistics

To get started, let’s take a look at the various ways statistics can be created and updated. Statistics are created in several ways: automatically by the Query Optimizer (if the default option to automatically create statistics, AUTO_CREATE_STATISTICS, is on), when an index is created...

lock icon The rest of the chapter is locked
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}