Skip to Content
0
Dec 07, 2020 at 09:23 PM

Use of histograms - SAP Oracle

150 Views Last edit Dec 07, 2020 at 10:24 PM 2 rev

We have multiple clients in our production landscape. Two additional clients with very limited data and expected to be retired in a year or two (less than 1% of the data of the entire table).

Unfortunately, when we run a query where there is no appropriate index the optimizer chooses an index randomly (any index with MANDT) and goes forward. This index is extremely inefficient and easily takes multiple minutes (for tables with 2 million rows).

I was thinking histogram would be a solution, but I noticed that even with histogram, SAP will not use histogram due to bind variables (797629 - FAQ: Oracle histograms). I guess with custom program we can use substitution variable with histogram to get over the hump , but I know DB hints are not SAP best practices. Further, this will not work for standard SAP program.

What is SAP recommended best practice for such scenarios? Just wondering is there a way to only not use bind variable for MANDT ?