Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Performance

Former Member
0 Kudos

Hi,

I would like to know which statement is better in case of performanance

select single * from LFA1 where....

or

select single f1 f2 from LFA1 where...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

select single f1 f2 from LFA1 where... is better than using select single * , as LFA1

contains lots of fields ...

better to select the required fields than selecting all the fields ...

6 REPLIES 6

Former Member
0 Kudos

u can use st05

Former Member
0 Kudos

Hi,

If u needonly particular fields, then the below is best statement rather than

" Select *.......".

select single f1 f2 from LFA1 where... -> Better.

Rvert back if any issues,

Regards,

Naveen

Former Member
0 Kudos

Hi,

If u are selecting some fields from the table then select single f1 f2 from LFA1 is better.

eg

if the internal table is having fields f1 f2 f2 in sequence then

select f1 f2 f3 from lfa1 into table itab where =.... gives better performance.

regards,

Santosh Thorat

Former Member
0 Kudos

select single f1 f2 from LFA1 where... is better than using select single * , as LFA1

contains lots of fields ...

better to select the required fields than selecting all the fields ...

sumajagan
Explorer
0 Kudos

Hi Neha,

it is better to go with select single f1 f2 from LFA1 where... rather than going with select single * from LFA1 where..... because if u go check the runtime analysis of the both statements the first statement will take less time compared to second one.

Former Member
0 Kudos

HI

SELECT SINGLE F1 F2 FROM WILL BE GOOD COMPARED TO SELECT SINGLE *

IF YOU WANT YOU CAN TRACE OUT THE CODE USEING ST05 LIKE THIS

SQL Trace transaction ST05: The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.

The trace list contains different SQL statements simultaneously related to the one SELECT statement in the ABAP program. This is because the R/3 Database Interface - a sophisticated component of the R/3 Application Server - maps every Open SQL statement to one or a series of physical database calls and brings it to execution. This mapping, crucial to R/3s performance, depends on the particular call and database system. For example, the SELECT-ENDSELECT loop on a particular database table of the ABAP program would be mapped to a sequence PREPARE-OPEN-FETCH of physical calls in an Oracle environment.

The WHERE clause in the trace list's SQL statement is different from the WHERE clause in the ABAP statement. This is because in an R/3 system, a client is a self-contained unit with separate master records and its own set of table data (in commercial, organizational, and technical terms). With ABAP, every Open SQL statement automatically executes within the correct client environment. For this reason, a condition with the actual client code is added to every WHERE clause if a client field is a component of the searched table.

To see a statement's execution plan, just position the cursor on the PREPARE statement and choose Explain SQL. A detailed explanation of the execution plan depends on the database system in use.

Starting the Trace:

To analyze a trace file, do the following:

...

Choose the menu path Test  Performance Trace in the ABAP Workbench or go to Transaction ST05. The initial screen of the test tool appears. In the lower part of the screen, the status of the Performance Trace is displayed. This provides you with information as to whether any of the Performance Traces are switched on and the users for which they are enabled. It also tells you which user has switched the trace on.

Using the selection buttons provided, set which trace functions you wish to have switched on (SWL trace, enqueue trace, RFC trace, table buffer trace).

If you want to switch on the trace under your user name, choose Trace on. If you want to pass on values for one or several filter criteria, choose Trace with Filter. Typical filter criteria are: the name of the user, transaction name, process name, and program name.

Now run the program to be analyzed.

Stopping the Trace:

To deactivate the trace:

...

Choose Test Performance Trace in the ABAP Workbench. The initial screen of the test tool appears. It contains a status line displaying the traces that are active, the users for whom they are active, and the user who activated them.

Select the trace functions that you want to switch off.

Choose Deactivate Trace. If you started the trace yourself, you can now switch it off immediately. If the performance trace was started by a different user, a confirmation prompt appears before deactivation-

Analyzing a Sample trace data:

PREPARE: Prepares the OPEN statement for use and determines the access method.

OPEN: Opens the cursor and specifies the selection result by filling the selection fields with concrete values.

FETCH: Moves the cursor through the dataset created by the OPEN operation. The array size displayed beside the fetch data means that the system can transfer a maximum package size of 392 records at one time into the buffered area.