Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cardinality Regression


Cardinality Regression

Author
Message
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36174 Visits: 18751
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
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6762 Visits: 17733
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
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4174 Visits: 4849
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
www.seavus.com
Eirikur Eiriksson
Eirikur Eiriksson
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6762 Visits: 17733
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
TomThomson
TomThomson
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10731 Visits: 12019
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
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6762 Visits: 17733
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
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16465 Visits: 13207
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?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Igor Micev
Igor Micev
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4174 Visits: 4849
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
www.seavus.com
Eirikur Eiriksson
Eirikur Eiriksson
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

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

Smells like irony...:-P
Cool
free_mascot
free_mascot
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2879 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