×

Lightup Virtual Conference

Date/Time: Tuesday, July 14, 2020 21:00 to 22:00 EST
Location: Virtual

View Event: Think Like The Cardinality Estimator

SQL Server uses a phase during query optimization, called cardinality estimation (CE). This process makes estimates based on the statistics as to how many rows flow from one query plan iterator to the next. Knowing how CE generates these numbers will enable you to write better TSQL code and in turn, influence the type of physical operations during query execution. Based on that estimated rows, the query processor decides how to access an object, which physical join to use, how to sort the data. Do you know how the CE generates these numbers? If your query has only one predicate, the query optimizer will use the histogram to estimate how many rows will be qualified. What happens when you have multiple predicates, range predicates, variable values that are “NOT KNOWN” to the optimizer, or you have predicate values increasing in ascending order? Do you know what will happen if your predicate is using an amount that is outside of the histogram range?

In this session, I will show you how cardinality estimator estimates in all of these scenarios. You will walk out of this session with a clear understanding of how the CE generates its numbers and ready to tackle those nasty, hard to solve query plans.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.


profile for SqlWorldWide on Stack Exchange, a network of free, community-driven Q&A sites

Kubernetes Learning Path

50-days from zero to
hero with Kubernetes

Download eBook

Q: If I hold an *exclusive lock* on a row, can another transaction running at (the default) *locking read committed* ... isolation level read it?

A: Yes!

SQL Server can skip shared locks if there is no risk of reading uncommitted data without them:

https://www.sql.kiwi/2010/11/read-committed-shared-locks-and-rollbacks.html

facebook copied my entire app, then renamed it IG Threads. pro tip: don’t present your hard work at their developer ... conferences https://twitter.com/dhof/status/1288233909931642880

dom hofmann@dhof

facebook has copied a lot of my work

Next Virtual Boston Azure (@bostonazure + @NorthBTownAzure) meetup will be on Tuesday 8/11. Learn very useful @Azure ... tips and tricks from the one and only @mbcrump. As always, don’t forget to RSVP here: https://www.meetup.com/bostonazure/events/272237070/ #AzureTipsAndTricks #Azure

Not an acceptable distance for a weekend run.
Blame kids activity.
Have to go out for another run or cycling.
... #selfcare
#sqlrun

Learn about "The Good, The Bad, and The Ugly" with TempDB next week (📅 Aug 12) with @SQLGoddess: ... https://bit.ly/2D08fJJ #AzureSQL

Load More...