Answered by:
Is Stored Procedure is Complied

Question
-
Hi All,
I Have Two basic Questions
- Is Stored Procedure is Complied ? if Yes Than what is meaning of compilations in Sql Server?
- Is View is Complied?
HandaTuesday, January 5, 2010 4:23 AM
Answers
-
1. Almost queries(including adhoc, proc, trigger, etc) are compiled
2. Compiling has some process, parsing, resolving, optimizing, etc...
3. (General) View(and Derived Talble, Inline Table-valued Function) is a something alias(or macro) of the query.
The query embedded view is actually compiled
I hope that helps
Thanks
Best Regards,
Jungsun Kim- Marked as answer by Jinchun ChenMicrosoft employee Friday, January 15, 2010 9:31 AM
Tuesday, January 5, 2010 5:05 AM -
Hello Ritesh,
When ever we execute query Optimizer create a querie plan for the execution. But for the Store procedure that execution plan is get stored on the procedure cache at the first time of execution. Thus while sp are faster because of pre compiled. About view its just a metadata form of base table. If you create index then it perform like a table.
Thanks
RM Thirunavukkarasu- Proposed as answer by Thirunavukkarasu RM Wednesday, January 13, 2010 6:10 AM
- Marked as answer by Jinchun ChenMicrosoft employee Friday, January 15, 2010 9:31 AM
Tuesday, January 5, 2010 6:36 AM
All replies
-
1. Almost queries(including adhoc, proc, trigger, etc) are compiled
2. Compiling has some process, parsing, resolving, optimizing, etc...
3. (General) View(and Derived Talble, Inline Table-valued Function) is a something alias(or macro) of the query.
The query embedded view is actually compiled
I hope that helps
Thanks
Best Regards,
Jungsun Kim- Marked as answer by Jinchun ChenMicrosoft employee Friday, January 15, 2010 9:31 AM
Tuesday, January 5, 2010 5:05 AM -
Hello Ritesh,
When ever we execute query Optimizer create a querie plan for the execution. But for the Store procedure that execution plan is get stored on the procedure cache at the first time of execution. Thus while sp are faster because of pre compiled. About view its just a metadata form of base table. If you create index then it perform like a table.
Thanks
RM Thirunavukkarasu- Proposed as answer by Thirunavukkarasu RM Wednesday, January 13, 2010 6:10 AM
- Marked as answer by Jinchun ChenMicrosoft employee Friday, January 15, 2010 9:31 AM
Tuesday, January 5, 2010 6:36 AM