PromotionInformationGetRedemptions sql being called too many times

Vote:
 

Hi,

I am using Commerce 12.15.0.

I am trying to find the promotion price of an item using GetDiscountPrices method (I pass the content reference and the market to it). And I see from the reflector it is calling the GetRedemptionsFromDatabase method behind the scenes which in turn triggers the PromotionInformationGetRedemptions sql. And upon looking into the SQL Profiler, I see this being called many times which I was hoping will not be the case and this will be read from the cache instead. Also, this only happens when the redemption limits are set.

Example: When I set the redemption per customer to 1 (Promotion used : Buy Products for Discount on All Selections)

This has a significant performance impact, I was hoping this could be cached instead and not trigger a db call everytime. Is this expected behavior?

#207128
Edited, Sep 12, 2019 20:11
Vote:
 

It is cached for per-promotion redemption. we decided that it would be too much to cache per-customer redemption (all customers x all promotions). however that might change...

in the latest version of commerce that SP is optimized so it will be much more lightweight. You might want to try that 

#207134
Sep 11, 2019 9:20