bibi92
asked on
how can I fix plan for stored procedure?
Hello,
Is it possible to fix plan for stored procedure?
Is it possible to fix NestedLoops Optimized?
Thanks
Regards
bibi
Is it possible to fix plan for stored procedure?
Is it possible to fix NestedLoops Optimized?
Thanks
Regards
bibi
When you say "fix" plan, do you mean use the same plan each time, use a different plan each time or "improve" the execution plan?
If by "fix" you mean "correct", which I think is what you mean, then ge325's suggestion of WITH RECOMPILE is what you need.
A "bad" nested loops is almost always the result of bad statistics. You likely need to update the statistics on a table(s).
[
If by "fix" you mean "force it to be the same", you might be able to force a certain plan structure on a query with a "Plan Guide". It's highly unusual, though, to need, or even want, that.
]
A "bad" nested loops is almost always the result of bad statistics. You likely need to update the statistics on a table(s).
[
If by "fix" you mean "force it to be the same", you might be able to force a certain plan structure on a query with a "Plan Guide". It's highly unusual, though, to need, or even want, that.
]
ASKER
Hello,
Thanks. How can I force a certain plan structure on a query with a "Plan Guide".
Regards
bibi
Thanks. How can I force a certain plan structure on a query with a "Plan Guide".
Regards
bibi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks bibi
Is there any reason you are looping? If you post your query there might be ways of doing set based info.
Otherwise the loops are what they are.