Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Forced Parameterization Expand / Collapse
Author
Message
Posted Tuesday, January 22, 2013 4:15 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:44 AM
Points: 1,371, Visits: 2,597
Hi All

Having checked the web and done some testing, I just want to confirm my understanding of SQL's plan cache

Am I right in that when your Database is under Forced Parameterization, it acts the same as Simple Parameterization but for all Ad-Hoc queries.

I've tested the setting on my system and it seems that Forced Parameterization creates nonparameratized plan shells, the same way Simple Parameterization would, if the query qualified for it.

Am I on track here

Thanks
Post #1409916
Posted Wednesday, January 23, 2013 4:37 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:59 AM
Points: 14,796, Visits: 27,270
There's a pretty focused set of requirements for forced parameterization to work. It's a lot more expanded than simple parameterization, but it does not include ALL ad hoc queries. Microsoft has the requirements documented in the Books Online.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1410473
Posted Wednesday, January 23, 2013 11:20 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:44 AM
Points: 1,371, Visits: 2,597
Grant Fritchey (1/23/2013)
There's a pretty focused set of requirements for forced parameterization to work. It's a lot more expanded than simple parameterization, but it does not include ALL ad hoc queries. Microsoft has the requirements documented in the Books Online.



Thanks

I just wanted to confirm that with Forced Parameterization - We will deal with plan "shells" ?

Thanks
Post #1410723
Posted Wednesday, January 23, 2013 11:52 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:59 AM
Points: 14,796, Visits: 27,270
SQLSACT (1/23/2013)
Grant Fritchey (1/23/2013)
There's a pretty focused set of requirements for forced parameterization to work. It's a lot more expanded than simple parameterization, but it does not include ALL ad hoc queries. Microsoft has the requirements documented in the Books Online.



Thanks

I just wanted to confirm that with Forced Parameterization - We will deal with plan "shells" ?

Thanks


Plan shells? Not sure what you mean. If you mean plan stubs, then no, that's not from Forced Parameterization. It's from Optimize for Ad Hoc. It's a different setting entirely.


----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1410738
Posted Wednesday, January 23, 2013 11:04 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:44 AM
Points: 1,371, Visits: 2,597
Grant Fritchey (1/23/2013)
SQLSACT (1/23/2013)
Grant Fritchey (1/23/2013)
There's a pretty focused set of requirements for forced parameterization to work. It's a lot more expanded than simple parameterization, but it does not include ALL ad hoc queries. Microsoft has the requirements documented in the Books Online.



Thanks

I just wanted to confirm that with Forced Parameterization - We will deal with plan "shells" ?

Thanks


Plan shells? Not sure what you mean. If you mean plan stubs, then no, that's not from Forced Parameterization. It's from Optimize for Ad Hoc. It's a different setting entirely.


Thanks

No, not stubs

By Shells, I mean this: These ad-hoc entries are shell queries, cached just to make the parameterised form of the query easier to find. All the execution plan contains for these shell queries is a pointer to the plan for the parameterised version of the query.
- Taken from http://sqlinthewild.co.za/index.php/2010/08/31/come-and-gone/

Under Simple Parameterization, if a Query qualifies for it, SQL caches a Parameterized plan with an objtype of "Prepared", any subsequent queries that make use of that plan is also cached, as "Non Parameterized Shell Queries" with an objtype of "AdHoc"

I was noticing the same thing happening with Forced Parameterization.
Post #1410906
Posted Thursday, January 24, 2013 4:49 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:59 AM
Points: 14,796, Visits: 27,270
Not a detail I had noticed before. But yes, the shells are there. I recreated Gail's tests.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1411060
Posted Thursday, January 24, 2013 6:37 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:44 AM
Points: 1,371, Visits: 2,597
Grant Fritchey (1/24/2013)
Not a detail I had noticed before. But yes, the shells are there. I recreated Gail's tests.


Great Stuff, Thanks

It would be great if SQL could single out the Plan Shells, so that when we query against the cached_plans DMV, it shows that this is a Shell Query

Thanks
Post #1411108
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse