Plan Freezing feature in sql 2k8

generic
Member Posts: 511
Hello I read that sql 2k8 has a new feature called "Plan Freezing". SQL Server 2008 enables greater query performance stability and predictability by providing new functionality to lock down query plans.
I was wondering if anybody has implemented this for a NAV db. thanks.
I was wondering if anybody has implemented this for a NAV db. thanks.
0
Comments
-
Hi!
Well, "Plan Freezing" is actually just another term for "Plan Guides" - which were already introduced with SQL Server 2005.
So, yes, once I used indeed "Plan Guides" with NAV, e.g. to apply RECOMPILE hints.
For example:EXEC sp_create_plan_guide @name = N'SSI_Guide1', @stmt = N'SELECT * FROM "navision"."dbo"."CRONUS$Document Dimension" WITH (UPDLOCK, ROWLOCK) WHERE (("Table ID"=@P1 OR "Table ID"=@P2)) AND (("Document Type"=@P3)) AND (("Document No_"=@P4)) ORDER BY "Table ID","Document Type","Document No_","Line No_","Dimension Code" OPTION (FAST 25)', @type = N'SQL', @module_or_batch = NULL, @params = N'@P1 int,@P2 int,@P3 int,@P4 varchar(20)', @hints = N'OPTION (RECOMPILE)'
The default NAV way of RECOMPILE-hinting is to apply the required parameters in "$ndo$sbconfig", then the C/SIDE client will send the query hint. But unfortunately the "dbconfig" thing is not very specific, actually you have to hint on table "granularity". Using RECOMPILE hints on heavily used tables on systems with small CPU capacity could cause problems ...
With Plan Guides you could be more specific - on query "granularity", so to speak - you apply a hint for a very specific query pattern. Thus, the advantage is to limit the amount of recompiles, avoiding too much pressure on the CPU. But the disadvantage is, that if the query changes - e.g. because a user changed a filter - the Plan Guide does not match anymore.
And if you have too many Plan Guides it's not easy to maintain all that stuff ...
Nowadays SQL Servers are (should be, at least) mostly sufficiently sized so that the "normal" way of RECOMPILE hinting via "$ndo$dbconfig" should do ...
I didn't use Plan Guides for anything else .. yet ... maybe with SQL 2008 this has been further improved ... I should look into that, again ... 8)
Regards,
JörgJörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
P.S.: You could also check this one out: http://blogs.msdn.com/sqlblog/archive/2009/02/19/plan-guides-plan-freezing-in-sql-server-2005-2008.aspxJörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions