Jump to content

How to optimize DB querying with eager loading strategy


Simone Salerno

Recommended Posts

If you experience some slowness on some of your pages, mainly those with lots of products (like the category page), it can be because of an inefficient querying strategy from Prestashop to the database. I tried solving this problem via eager loading and I got some good results I want to share with you.

 

You will need a DbQuery override to implement the eager loading strategy and to edit all the places where Prestashop uses an inefficient lazy loading strategy.

 

You can find all you need on my Github repo with all the code here (copy-paste the classes there).

You can find a short post about this on my site here with a graph and a table with data.

Long story short: with half the optimization I got a -25% in the number of queries and -20% in the response time.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...