Adding hints in SELECT clause

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.

Getting ready

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 ...

Get SAP ABAP Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.