If there are many indexes that contain common fields (or for any other reason), the database optimizer cannot decide the right index to be used for a particular query, and then use a wrong index that may not be of optimal performance. From SAP Release 4.5, hints can be provided using the %_HINTS
parameter. In this recipe, we will see the syntax for specifying HINTS
within your SELECT
clause in order for a particular index to be used by the database optimizer. We will see how the hints may be specified when the underlying database is MS SQL Server.
In this recipe, we will have a small program that runs a SELECT
statement on the table ZST9_VBAK
. We will use the index (Z12
) that we created in the previous Creating Secondary Indexes in Database Tables recipe.