Forced Parameterization

  • 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

  • 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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • 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

  • 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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • 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.

  • 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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • 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

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply