SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cardinality Regression


Cardinality Regression

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: Administrators
Points: 65199 Visits: 19118
Comments posted to this topic are about the item Cardinality Regression

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Eirikur Eiriksson
Eirikur Eiriksson
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15700 Visits: 18626
Good question, thanks Steve.
Cool
Still some confusion in the documentation at support.microsoft.com:
The following plan affecting trace flags are available in Microsoft SQL Server 2014:

9481
Use when running SQL Server 2014 with the default database compatibility level 120. Trace flag 9481 forces the query optimizer to use version 70 (the SQL Server 2012 version) of the cardinality estimator when creating the query plan.

2312
Use when running SQL Server 2014 with database compatibility level 110, which is the compatibility level for SQL Server 2012. Trace flag 2312 forces the query optimizer to use version 120 (the SQL Server 2014 version) of the cardinality estimator when creating the query plan.

Igor Micev
Igor Micev
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5996 Visits: 5084
Confusion!?

2312 - http://support.microsoft.com/kb/2801413
Use when running SQL Server 2014 with database compatibility level 110, which is the compatibility level for SQL Server 2012. Trace flag 2312 forces the query optimizer to use version 120 (the SQL Server 2014 version) of the cardinality estimator when creating the query plan.

9481 - http://msdn.microsoft.com/en-us/library/dn600374%28v=sql.120%29.aspx
Once your workload is running with the new cardinality estimator (database compatibility level 120), and a specific query has regressed, you can run the query with trace flag 9481 to use version 70 (the SQL Server 2012 version) of the cardinality estimator.

Since you don't have the option for trace flag 9481, then changing the compatibility level to 110 is the right answer.

Igor Micev,
SQL Server developer at Seavus
My blog: www.igormicev.com
Eirikur Eiriksson
Eirikur Eiriksson
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15700 Visits: 18626
Igor Micev (6/1/2014)
Confusion!?

2312 - http://support.microsoft.com/kb/2801413
Use when running SQL Server 2014 with database compatibility level 110, which is the compatibility level for SQL Server 2012. Trace flag 2312 forces the query optimizer to use version 120 (the SQL Server 2014 version) of the cardinality estimator when creating the query plan.

9481 - http://msdn.microsoft.com/en-us/library/dn600374%28v=sql.120%29.aspx
Once your workload is running with the new cardinality estimator (database compatibility level 120), and a specific query has regressed, you can run the query with trace flag 9481 to use version 70 (the SQL Server 2012 version) of the cardinality estimator.

Since you don't have the option for trace flag 9481, then changing the compatibility level to 110 is the right answer.


Check this thread:-D
Cool
Tom Thomson
Tom Thomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14678 Visits: 12238
When I saw this, I found myself wondering if this were the documentation bug again or not? It could be a trick question, where the "correct" answer was the only answer provided that would run teh query with the old cardinality estimator, so the poor practice answer (use compatibility level) would be "correct" despite being poor practice for dealing with a single query rather than all queries in a DB. After all, it was just over a fortnight since STeve's last question on this topic and the documentation error was thoroughly aired then, surely he would have correted this one by now?
Anyway, in the end I decided it was probably a repeat of believing teh wrong BOL page and got it right by selecting an option that wouldn't actually work.

Tom

Eirikur Eiriksson
Eirikur Eiriksson
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15700 Visits: 18626
TomThomson (6/1/2014)
When I saw this, I found myself wondering if this were the documentation bug again or not? It could be a trick question, where the "correct" answer was the only answer provided that would run teh query with the old cardinality estimator, so the poor practice answer (use compatibility level) would be "correct" despite being poor practice for dealing with a single query rather than all queries in a DB. After all, it was just over a fortnight since STeve's last question on this topic and the documentation error was thoroughly aired then, surely he would have correted this one by now?
Anyway, in the end I decided it was probably a repeat of believing teh wrong BOL page and got it right by selecting an option that wouldn't actually work.


+1 (Ditto)
Cool
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28151 Visits: 13268
Gah, again!

I have found so many resources (not only MSDN) saying trace flag 2312 is used to run a query with the new cardinality estimator, not to disable it.
So the only correct option would have been to set the compatibility level...


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Igor Micev
Igor Micev
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5996 Visits: 5084
Eirikur Eiriksson (6/1/2014)
Igor Micev (6/1/2014)
Confusion!?

2312 - http://support.microsoft.com/kb/2801413
Use when running SQL Server 2014 with database compatibility level 110, which is the compatibility level for SQL Server 2012. Trace flag 2312 forces the query optimizer to use version 120 (the SQL Server 2014 version) of the cardinality estimator when creating the query plan.

9481 - http://msdn.microsoft.com/en-us/library/dn600374%28v=sql.120%29.aspx
Once your workload is running with the new cardinality estimator (database compatibility level 120), and a specific query has regressed, you can run the query with trace flag 9481 to use version 70 (the SQL Server 2012 version) of the cardinality estimator.

Since you don't have the option for trace flag 9481, then changing the compatibility level to 110 is the right answer.


Check this thread:-D
Cool

Hm, ah, aham, ok. Smile

Igor Micev,
SQL Server developer at Seavus
My blog: www.igormicev.com
Eirikur Eiriksson
Eirikur Eiriksson
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15700 Visits: 18626
d. There is nothing you can do except update your resume

Smells like irony...:-P
Cool
free_mascot
free_mascot
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4091 Visits: 2235
Thank you, Steve. Easy One.

---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search