‎2008 Feb 04 5:48 AM
Hi,
Is it mandatory to use all the fields of an index in the where clause of a select statement in terms of performance.
Thanks,
K.Kiran.
‎2008 Feb 04 5:50 AM
its not mandatory that you need to use all.. use what all you wanted.. but what ever you choose its better to be a primary key field.
‎2008 Feb 04 5:50 AM
its not mandatory that you need to use all.. use what all you wanted.. but what ever you choose its better to be a primary key field.
‎2008 Feb 04 5:51 AM
Hi,
YES it is Good to use all the fields of an index in the where clause of a select statement in terms of performance.
Better to pass...
Specially in case of SELECT single...
REward if helpful..
GAURAV J.
Edited by: GAURAV on Feb 4, 2008 6:51 AM
‎2008 Feb 04 6:01 AM
Check for Equality and Link Using AND The database index search is particularly efficient if you check all index fields for equality (= or EQ) and link the expressions using AND.
‎2008 Feb 04 6:03 AM
It is always good to use index for the selction criteria of your select statement, however you need not use all the index.
‎2008 Feb 04 6:34 AM
Hi,
Getting a mixed response.Looking forward to more replies.
K.Kiran.
‎2008 Feb 04 9:45 AM
select b~mblnr
b~menge
b~lfbnr
b~lfpos
from mseg as b
inner join mkpf as a
on bmblnr = amblnr
into corresponding fields of table it_rjct
where b~werks = p_werks and
a~budat between it_cperiod-begda and it_cperiod- endda and
b~bwart = '122' and
b~ebeln NE SPACE.
In MSEG werks and bwart are in secondary index.
In MKPF budat is in secondary index.
Does the above select statement satisifies the following conditions in terms of usage of indexes.How to fine tune it.
Check for Equality and Link Using AND
The database index search is particularly efficient if you check all index fields for equality (= or EQ) and link the expressions using AND.
Use Positive Conditions
The database system only supports queries that describe the result in positive terms, for example, EQ or LIKE. It does not support negative expressions like NE or NOT LIKE.
If possible, avoid using the NOT operator in the WHERE clause, because it is not supported by database indexes; invert the logical expression instead.
Thanks,
K.Kiran.
Edited by: Kiran K on Feb 4, 2008 10:49 AM
‎2008 Feb 04 9:57 AM
Hi,
ITS not mandatory
But to raise performance you should try to pass it..
REGARDS,
GAURAV J.