10-20-2008 12:18 PM
Hi,
wht is the difference between writing a query using/with-out using %_HINTS ORACLE on BSEG & BKPF tables.
Is there any performance issue if we write the queries using hints.
Please see the below queries.
SELECT bukrs
belnr
gjahr
FROM bkpf INTO TABLE i_bkpf
WHERE AND bukrs EQ p_bukrs
AND gjahr EQ p_gjahr
AND monat EQ p_monat
AND blart IN s_blart
AND stgrd EQ ''
%_HINTS ORACLE
'INDEX("T_00" "BKPF~0" "BKPF^0" "BKPF______0" "BKPF______0__X")'.
SELECT bukrs
belnr
gjahr
FROM bseg INTO TABLE i_bseg
WHERE bukrs EQ i_bkpf-bukrs
%_HINTS ORACLE
'INDEX("T_00" "BSEG~0" "BSEG^0" "BSEG______0" "BSEG______0__X")'.
Regards,
vinod
10-20-2008 12:28 PM
Hi,
If you give Hints, you are forcing the DB to use the particular index you are specifying through %_HINTS ( In your case its T_00 )
If you dont give index, SAP will analyse the fields in WHERE clause and its order and pick the best available index to fetch data.
There is no need to specify index like this, as SAP is wise enough to pick the correct index if you give all the index fields in same order as that of index.
So try to avoid using %_HINTS.
Cheers,
Kothand
10-20-2008 12:30 PM