0

Couple of days before someone asked me a question that, if one same simple query getting executed from any application in three different way: 1. By inline statement 2. By calling a SP with same query 3. By calling a SP with same query, but uses the EXEC statement.

I need the difference in their performance along with the difference in their execution plan. Sir when try to execute the three different query at a same time and check the execution plan, I haven’t got any difference there, I am really puzzled here please help me out.

  • 1
    Why are you assuming there **is** any (significant) difference in their performance or in their execution plan? – David M Jul 03 '12 at 13:50

1 Answers1

0

if query is exact same, there will be no difference in execution plan. because execution plan is of query and does not depends on how it is called

Zia
  • 921
  • 5
  • 14
  • There are other factors that may affect the eventual execution plan in SQL Server. Check out [this question](http://stackoverflow.com/questions/1007397/sql-poor-stored-procedure-execution-plan-performance-parameter-sniffing "SQL poor stored procedure execution plan performance - parameter sniffing") for an example. – Andriy M Jul 05 '12 at 12:54
  • @Andiry M , i said "if query is exact same", the link u had given is a totally different case – Zia Jul 05 '12 at 13:05
  • That question is about the same query having different execution plans in different situations, which is what I only meant to point out in reply to your *‘if query is exact same, there will be no difference in execution plan’*. – Andriy M Jul 05 '12 at 15:28