Search This Blog
Friday, September 29, 2006
ST05 - SP vs SQL explain
Note 155413 says the following ...The output of the ST05 trace contains the runtime of theindividual SQL statements in microseconds (1.0E-6 sec). SQLstatements with longer runtimes are displayed red.- Select the slowest SQL statement and press the "Explain SQL"pushbutton.The execution plan for this SQL statement appears. The executionplan shows the indices, which the SQL Server would use at thepresent time to execute the SQL statement. This execution planmay change as soon as the contents of the database changes or anautomatic statistics update is executed.Therefore it shows the exact execution plan that is used at the time ofthe statment being run.Next onto the part about stored proceedures it states ....SAP R/3 uses Stored Procedures (SP's) for accessing the SQLServer. The SQL Server generates the execution plan during thefirst call of the SP. All additional calls use the same executionplan until the SP is re-compiled (caused, for example, by anautomatic statistics update). This improves the overallperformance of the R/3 System. However, in rare cases this canresult in very long-running SQL statements.- See Note 159171According to this part of the note the execution plan for a SQL commandis stored in cache and used again on the next time a similar commandis executed and so on.Refreshing the statistics forces the Stored Procedures to be recompiledagain and the execution plans to be updated. The following commandshould have the same effectexec sp_recompile
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment