Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
carumuga
Posting Yak Master
174 Posts |
Posted - 2009-02-05 : 03:03:35
|
Hi,Can anyone tell me when to use KEEPFIXED PLAN and KEEP PLAN query hint with examples.I know that KEEPFIXED PLAN can be used when there is a change in the statistics i.e when there is huge volume of data changes in the index columns. |
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-05 : 07:04:39
|
They are especially used when you are using lots of Temp table inside stored procedure so it won't recompile. |
|
|
tonymorell10
Yak Posting Veteran
90 Posts |
Posted - 2009-02-05 : 09:25:51
|
Be careful when using these query hints. Both hints will reduce recompiles. However, they may also prevent a better plan from being created. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-05 : 09:50:03
|
quote: Originally posted by tonymorell10 Be careful when using these query hints. Both hints will reduce recompiles. However, they may also prevent a better plan from being created.
That depends on how statistics are upto- date. |
|
|
carumuga
Posting Yak Master
174 Posts |
Posted - 2009-02-06 : 02:12:46
|
My question is when to use KEEP PLAN query hint as both hints reduces recompiles, any differences between these two. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-06 : 08:47:23
|
As I said, KEEP PLAN is used for Temp tables and KEEP FIXED PLAN for Ad-hoc queries.Both are used to avoid recompilations. |
|
|
|
|
|