2008 Dec 04 12:58 PM
Hi team,
Can you please suggest me how to add an Oracle hint to point the Program to BSAD~1.
Index BSAD1 has all three fields MANDT, BUKRS, AUGDT which are there in the where clause. But as per the execution plan index BSAD0 is being used which is the primary one.
Also the stats for this table are are current.
Thanks in Advance.
Puneet.
2008 Dec 04 3:53 PM
Hi punnet, look at this example:
SELECT MAX( kkop~augbd )
INTO it_gen_docs-augbd
FROM ( fkkvkp AS vkp INNER JOIN dfkkop AS kkop
ON vkpvkont = kkopvkont ) INNER JOIN dfkkko AS kkko
ON kkopaugbl = kkkoopbel
WHERE vkp~exvko = ti_cuentas-exvko
AND kkop~bukrs = p_bukrs
AND kkop~blart IN r_blart
AND kkop~augst = '9'
AND kkko~blart IN r_blartd
%_HINTS ORACLE 'INDEX("DFKKOP" "DFKKOP~Z07")'.
DFKKOP is the table name and DFKKOP~Z07 is the index.
I hope this helps you.
Hi team,
Can you please suggest me how to add an Oracle hint to point the Program to BSAD~1.
Index BSAD1 has all three fields MANDT, BUKRS, AUGDT which are there in the where clause. But as per the execution plan index BSAD0 is being used which is the primary one.
Also the stats for this table are are current.
Thanks in Advance.
Puneet.
2008 Dec 04 2:58 PM
BSAD is a secondary index table for customers. If you don't know the customer number, it's going to be pretty difficult to use this table.
Rob
2008 Dec 04 3:39 PM
Adding hints and so overriding the optimizers decision should be the absolute exception. Please post your select statement for BSAD here, especially the where-conditions, maybe there is an explanation why the primary key is being used instead of index 1.
Thomas
2019 Aug 19 1:24 PM
Optimizers need to be overridden all the time, that is the whole purpose of hints.
2019 Aug 20 1:29 PM
wow, more than ten years later…
This statement seems to come from a DB admin rather than an ABAP developer (the original post's context in 2008).
From a developer point of view, I do not agree with you, or I do not understand the 2019 context.
Please explain.
2019 Sep 10 2:17 PM
Interesting statement from an SAP employee. Seems I've done something wrong the last 30 years...
2008 Dec 04 3:53 PM
Hi punnet, look at this example:
SELECT MAX( kkop~augbd )
INTO it_gen_docs-augbd
FROM ( fkkvkp AS vkp INNER JOIN dfkkop AS kkop
ON vkpvkont = kkopvkont ) INNER JOIN dfkkko AS kkko
ON kkopaugbl = kkkoopbel
WHERE vkp~exvko = ti_cuentas-exvko
AND kkop~bukrs = p_bukrs
AND kkop~blart IN r_blart
AND kkop~augst = '9'
AND kkko~blart IN r_blartd
%_HINTS ORACLE 'INDEX("DFKKOP" "DFKKOP~Z07")'.
DFKKOP is the table name and DFKKOP~Z07 is the index.
I hope this helps you.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |