question

r_balaji_g avatar image
r_balaji_g asked

How JOIN Cardinality is calclulated

Can you please point me to an article or blog or books online or youtube video that explains how JOIN cardinality is calculated in SQL Server (Preferably SQL 2012). I've searched for this but couldn't find one... Thanks for the help!
sql server 2012statistics
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
KenJ avatar image
KenJ answered
"SQL Server estimates cardinalities primarily from histograms that are created when indexes or statistics are created, either manually or automatically" according to *Troubleshooting Poor Query Performance: Cardinality Estimation* - [ https://technet.microsoft.com/en-us/library/ms181034(v=sql.105).aspx][1]. JOINs are included in that broad overview and have a note about certain join techniques that prevent accurate cardinality estimates. You can also learn more about the previous cardinality estimator by reviewing articles about the new one. For example, the *Cardinality Estimator (SQL Server)* article on msdn - [ https://msdn.microsoft.com/en-us/library/dn600374(v=sql.120).aspx][2] lists several changed behaviors and describes both the before and after behavior. [1]: https://technet.microsoft.com/en-us/library/ms181034(v=sql.105).aspx [2]: https://msdn.microsoft.com/en-us/library/dn600374(v=sql.120).aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.