‎2008 Jan 17 12:47 PM
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.
‎2008 Jan 17 1:00 PM
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
‎2008 Jan 17 1:10 PM
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 .
‎2008 Jan 17 5:14 PM
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