‎2007 Jan 24 1:27 AM
Hi
I executed the Trace (ST05) for a program. when i see the 'Summarized SQL Statements: Sorted by Duration' i see the corresponding columns (Executions, Identical, Duration, etc.) for each SELECT.
But somebody can help with two doubts:
- Why in 'Executions' column i have a value of 436 for some SELECT but that Select statement is only executed one time (i set a breakpoint) ?
- The 'Duration' column is affected by the work-load of the server ? that is, if i run a trace for a program twice, this give me different results. Then how can i be sure , if i modificate the program, that i really improve the Selects ?
Thanks in advanced
Frank
‎2007 Jan 24 2:38 PM
The number of executions is affected by the way you are doing the select: SELECT SINGLE;SELECT/ENDSELECT;SELECT...FOR ALL ENTRIES.
The duration column is indeed affected by running it more than once. there is some buffering going on that will reduce the execution time for subsequent SELECTs of the same data. You can ease this by running the program without ST05 and then running it again with ST05 so that all SELECTs will be bufferred. A better way is to examine the "explain" of the SELECT in ST05. But this will be affected by the number of executions.
Rob
‎2007 Jan 24 1:45 AM
1. Duration figure is the runtime for the statement in the format milliseconds/microseconds.
2. When you improve or enhance SELECT statement, you can find the difference in the Runtime figure.
For more info, refer below link:
http://help.sap.com/saphelp_nw04/helpdata/en/d1/801f89454211d189710000e8322d00/frameset.htm
Thanks,
Santosh
‎2007 Jan 24 2:38 PM
The number of executions is affected by the way you are doing the select: SELECT SINGLE;SELECT/ENDSELECT;SELECT...FOR ALL ENTRIES.
The duration column is indeed affected by running it more than once. there is some buffering going on that will reduce the execution time for subsequent SELECTs of the same data. You can ease this by running the program without ST05 and then running it again with ST05 so that all SELECTs will be bufferred. A better way is to examine the "explain" of the SELECT in ST05. But this will be affected by the number of executions.
Rob
‎2007 Jan 24 4:22 PM
Thanks Rob
But , then, the 'Executions' is not the number of times wich a SELECT was executed ?
For example, i have two Selects i a program, both are executed only ONE time per execution:
a) SELECT *
FROM t179t
INTO TABLE i_prodh
WHERE spras EQ sy-langu.
b) SELECT vbeln
posnr
kunnr
parvw
FROM vbpa
INTO TABLE i_vbpa
FOR ALL ENTRIES IN i_vbap
WHERE vbeln EQ i_vbap-vbeln
AND parvw IN ('RE','ZS').
It's a sure fact that both selects are executed only One time; then why in the trace (ST05) the 'Execution' column has a value '1' for the first select; but it has a value of '436' for the second place ?
Can somebody help me please to understand this ?
Regards
Frank
‎2007 Jan 24 4:26 PM
What is your database system?
do you have 436 entries in i_vbap?
Rob
Message was edited by:
Rob Burbank
‎2007 Jan 24 4:34 PM
When you user FOR ALL ENTRIES, your SELECT statement will get executed as many times as number of rows in your internal table
‎2007 Jan 24 4:48 PM
Well, the ABAP SELECT statement will just be executed once, but it will be translated into something different when it goes to the database. It looks like it is going to the actual database once for each entry in the internal table, but I've also seen it grouped so that it only goes once for the entire table.
I don't worry about the details. Like I said in an earlier post, run it twice and look at the execution times of the second run.
Rob
‎2007 Jan 24 5:06 PM
In the table used for the FOR ALL ENTRIES , that is, i_vbap , i have 2,182 records. In the resulting filled table (i_vbpa) i get 2,481 records.
And in the Executions column, 436.
‎2007 Jan 24 5:08 PM
‎2007 Jan 26 5:44 PM
If you look at the ST05 trace of a for-all-entries selection, you'll notice that the select-statement is internally broken up into pieces, and a chunk of records, say 5 or 10, are exeucted in each where-clause. This is why, when you have 1-2k records in your itab, the for-all-entries selection gets executed some 400+ times.