We have only a handful of products in our system, but we require thousands of promotion codes. The more codes we have the slower the system gets.
For example, we currently have just over 3,000 codes and adding a code, removing a code, checking out, etc, each takes no less than 10 - 15 seconds to complete. If I remove promotions down to a handful, the performance returns to where I would expect.
I tried adding some indexes to the cscart_promotions and cscart_promotion_descriptions tables but it did not improve the performance.
- Does anyone else have our quantity of promotions?
- Are you performing well or poorly?
- Do you know why this might be happening?
- Is there a known limit to the number of promotions the system can handle well?
We are currenlty operating on version 4.1.2.
We actually found this issue and it has nothing to do with the SQL tables. It has to do with the way the fn_promotion_apply() function works. It pulls out ALL active promotions regardless if the page in question has any suitable products or not, then loops through every one of them. This is what causes the slow down. We're actually re-writing this function via hooks to eliminate that problem.
[quote name='extrarius' timestamp='1408391068' post='189883']
We're actually re-writing this function via hooks to eliminate that problem.
Thank you for your feedback. I would be greatly interested in any insight you might have after you have completed your override code, if you are willing to share.
I sincerely apologize for the late reply, we've been putting out a lot of fires. I filed a bug report with CS-Cart about the issue, hopefully some of our code will help you: