Application Development and Automation 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: 
Read only

regarding index

Former Member
0 Likes
608

hi ...

hw can i know the which index using in the select statment in the report s

Regars

Anand

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

uses <b>clustered index</b> to return the resultset efficiently and speedily

SELECT statement is not necessarily optimized by the database system or executed with the correct index. This can result in increased runtime costs. You should only use ORDER BY if the database sort uses the same index with which the table is read. To find out which index the system uses, <b>use SQL Trace in the ABAP Workbench Performance Trace.</b> If the indexes are not the same, it is more efficient to read the data into an internal table or extract and sort it in the ABAP program using the SORT statement.

Message was edited by:

Abap-fresher

hi ...

hw can i know the which index using in the select statment in the report s

Regars

Anand

3 REPLIES 3
Read only

Former Member
0 Likes
591

uses <b>clustered index</b> to return the resultset efficiently and speedily

SELECT statement is not necessarily optimized by the database system or executed with the correct index. This can result in increased runtime costs. You should only use ORDER BY if the database sort uses the same index with which the table is read. To find out which index the system uses, <b>use SQL Trace in the ABAP Workbench Performance Trace.</b> If the indexes are not the same, it is more efficient to read the data into an internal table or extract and sort it in the ABAP program using the SORT statement.

Message was edited by:

Abap-fresher

Read only

Former Member
0 Likes
590

Sorting by the Primary Key

To sort the selection set in ascending order by the primary key, use the following:

SELECT <lines> *

...

... ORDER BY PRIMARY KEY.

This sorting method is only possible if you use an asterisk (*) in the SELECT clause to select all columns. Furthermore, it only works if you specify a single database table in the FROM clause. You cannot use views or joins, since neither has a defined primary key.

Read only

Former Member
0 Likes
590

don't understand how the answers relate to the question.

The actual index can only be seen in the SQL trace, see my SQL trace blog:

/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy

of course, one can often guess from the runtimes whether the right index is used or not.

Siegfried