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 issue in a custom table

Former Member
0 Kudos

Hi All,

I have a ztable used in a program wherin I have a doubt of performance issue in selection.Its like :

SELECT ship_no invoice_no

INTO TABLE it_ship_no_hist

FROM zco_cust_hist

FOR ALL ENTRIES IN it_freight

WHERE ship_no = it_freight-tknum.

there are 7 key fields in this table out of which one ( tknum ) is used in a where condition.The table is without any index.

For performance purpose should I create an index with the very field 'tknum' in the index..can I do that or index should be created only along with non key fields.

3 REPLIES 3

former_member194613
Active Contributor
0 Kudos

Hi,

a table has - besides a few exceptions - always one index that is the primary key. The fields are the key fields in the same order as in the table.

The primary key is always there and therefore not displayed under the botton 'index'.

Is tknum a key field? What are the key fields in correct order? If it is in the key and maybe the first one, then it does not make sense that you create an index.

Siegfried

0 Kudos

Thanks Siegfried,

tknum is a key field and is the second key field after material number.The rest key fields after tknum are like Doc. no of invoice doumnet,cust. no ,reserve acct no, p& l acct no and posting date .

0 Kudos

Two options that I can think of:

Since tknum is not the first key field in the primary index, it may make sense to create an index on this field.

Change the order of the key fields in the table so that tknum is the first (key) field. This would also mean some analysis of other programs that create records into and read records from this table. IE - it may cause more problems than it fixes.

Rob