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: 

Index in SQL

Former Member
0 Kudos

hello experts, how can I implement index in my SQL Statements? can anyone provide simple code snippets... thank you very much in advance...

1 ACCEPTED SOLUTION

former_member186741
Active Contributor
0 Kudos

if the table you are using has an index you can try and get sql to use it by coding the fields of the index in the where clause of your select (in the same sequence as they appear in the index). Use ST05 to explain your sql if you can and this should confirm/deny whether your code uses an index or not.

6 REPLIES 6

Former Member
0 Kudos

Do you want to use a particular index? For that you would have to use HINTS. Or do you just want to make sure that your select is using an index effectively?

Rob

0 Kudos

You can use Hints( I think only for oracle db ). You can define the index in SE11. To make the select statement use the index, you must write your WHERE statement in the order of the indexed fields.

Regards,

Rich Heilman

0 Kudos

sir, i have lots of query in my ABAP program, and the program terminates because of timeout (maybe there is a time limit in the processing of SQL statements), Ive filtered my SQL alot, I even avoided innerjoins, the solution I think is maybe Indexing will help. thanks

0 Kudos

There is a time limit, but not on SELECT statements, the limit is on overall runtime. This is a global system setting. Using indexes can help the performance of the select statements, but could also decrease the performance when updating the TABLE that the index has been applied to. Can you please post your code, maybe we can make some suggestions.

Regards,

Rich Heilman

0 Kudos

Well we really need to see the select that's causing the problem. In this case you want o make sure your using an index effectively. So you won't want to use hints.

Rob

former_member186741
Active Contributor
0 Kudos

if the table you are using has an index you can try and get sql to use it by coding the fields of the index in the where clause of your select (in the same sequence as they appear in the index). Use ST05 to explain your sql if you can and this should confirm/deny whether your code uses an index or not.