Optimization - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.


Hello! I am a beginner programmer. I have a problem with the runtime of one of my applications.

I have a website application that tries to compute for recommended objects to users. The recommended results is based on the user as well as the currently viewed object.

My problem is, I have 500 artworks and almost 30 users. What I do is, for each user, I compute the value for recommendation for EACH artwork. So that means, for 1 object, I compare ALL of the other objects to it. Then after the computation, I store it in the Database. So for each user, I have around 250000 records inside the Database.

Can I have any tips regarding on how to optimize it? Either some changes to the Database model or some changes to the code. I have 3 FOR loops (1 for user, 1 for viewed object, 1 for target objects). I have already tried using UNION ALL, but the INSERT statements doesn't seem to be the case.

Help please!

Sign In or Register to comment.