on 08-03-2007 8:50 AM
hi experts,
i am using abap code which access a database table MCHB.
select matnr
werks
lgort
charg
clabs
ersda
into corresponding fields of table itab
from mchb
where matnr in pmatnr
and werks in mwerks
and lgort = plgort
and lgort = 'BSR'
and clabs > 0
AND ERSDA IN DATE1.
which contains more than 100000.
but for getting record from this we need more then 2 hr or more.
so please help me how to increase the performance of table.
thanks in advance.
1. use fields in the where clause which are indexed. if you specify one field in the where condition which is not indexed (or part of an index) the database engine has to read the complete table.
2. reduce the number of data returned by the selection
peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
First, you should provide the SQL code that is taking long time, not the ABAP code:
<i>select matnr
werks
lgort
charg
clabs
ersda
into corresponding fields of table itab
from mchb
where matnr in pmatnr
and werks in mwerks
and lgort = plgort
and lgort = 'BSR'
and clabs > 0
AND ERSDA IN DATE1.</i>
That way we could SEE what variables have you specified ( is matnr specified?, HOW is it specified? is werks specified? HOW is it specified? is DATE1 specified?, HOW is it specified? )
Then you are told to use an index. you reply that you are using an index. And you mention that you are using one:
<i>i am already using indexed field.
that are
charg.
lgort.
werks.</i>
If I'm not wrong "CHARG", mentioned by you, is not specified on the query
Lgort it is specified by "=", good. But we do not know about werks.
First impresion is that the index is not good, but it is not possible to mention if it is due to
1) bad user imput
2) no existance of a better index ...
Note, in my system I do not have any index on CHARG, IGORT and WERKS
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.