2009 Mar 16 7:00 AM
Hi all,
Here is a very basic question?
I am selecting data from a database table for e.g. KNA1. In order to quickly fetch data from this table, is it always adviceable to use available indexes along with the primary key fields?
Along with kunnr, should I look for some other indexes?
Thanks,
Rajan
2009 Mar 16 8:53 AM
Hi Rajan ,
One thing is sure ., for your selection requirement if you can get data based on KUNNR ,
u can directly use that with out thinking of any Index keys .
If in your selection criteria if there are any other fields go for index other wise not required as the each index will be created with its own Key field structure .
Thanks
Sreenivas Reddy
2009 Mar 16 8:03 AM
> I am selecting data from a database table for e.g. KNA1. In order to quickly fetch data
> from this table, is it always adviceable to use available indexes along with the primary key fields?
It is very unclear what you mean
a table has some fields
some fields in front are marked as keys, they are the key fields and build a unique key for the
table
the primary key or index is build out of the key fields
there can be other indexes they use other fields
Now what is your question?
If you use KNA1, then kunnr is the second keyfield, mandt come automatically, so
the full unique key is specified, only one record can be found.
Additional records can make sense, for example if you select with FOR ALL ENTRIES a number
of customers, with 1000 kunnr, you would get 1000 records (if they all exist). But if they must
fulfill additional conditions, for example come from a certain land, then you add this condition.
The search becomes not faster all 1000 customers are checked, but not all are transferred.
Siegfried
2009 Mar 16 8:53 AM
Hi Rajan ,
One thing is sure ., for your selection requirement if you can get data based on KUNNR ,
u can directly use that with out thinking of any Index keys .
If in your selection criteria if there are any other fields go for index other wise not required as the each index will be created with its own Key field structure .
Thanks
Sreenivas Reddy
2009 Mar 16 9:07 AM
Thanks Sreeni,
So, Now I believe, if I have primary key it is not necessary to look for indexes for quick data retrieval.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |