Subject Stored Procedures, Index Statistics and Plans
Author Ian A. Newby
Hi Folks,
It is my understanding that when stored procedures are compiled
the execution plan for the sql statements within them are
calculated.

When a database is created from script, the tables are typically
empty when the stored procedures are created. At this time the
statistics for all the indexes are the same (0).

Does this mean that the optimal plan will never be selected until
the both the index statistics are recalculated and the stored
procedures are recompiled?

If this is the case, is there any way to automatically re-compile
all procedures (assuming the source exists!) perhaps using EXECUTE
STATEMENT ...

(This post was influenced by the threads debating the possibility
of automatically recompiling stored procedures and triggers.)

Regards
Ian Newby