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


Forced Parameterization


Forced Parameterization

Author
Message
SQLSACT
SQLSACT
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4916 Visits: 2969
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
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97751 Visits: 33014
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 Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
SQLSACT
SQLSACT
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4916 Visits: 2969
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
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97751 Visits: 33014
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 Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
SQLSACT
SQLSACT
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4916 Visits: 2969
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.
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97751 Visits: 33014
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 Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
SQLSACT
SQLSACT
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4916 Visits: 2969
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
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