Get Free Audit

Speeding up Prestashop: Database Requests Amount

Apr 17, 2014

820 Alex Simonchik

Speeding up Prestashop: Database Requests Amount

Our clients very often ask us why their stores don’t work as fast as they want. Sometimes the bottleneck of store’s performance is its database. Some modules create a lot of non-optimized requests. Today we will speak about the ways of showing the amount of database requests.

One of the ways will help us find out if your database is overloaded. Before installing new module we recommend to check how many requests was there before and after the procedure.

So, method DB::getInstance() is responsible for every database request, so we’ll install our calculator exactly in this method. To do that let’s set $queries variable in the beginning of the method:


Add increment operation of the amount of database requests in method DB::getInstance():


Let’s also add static method DB:: getCount() to count the database requests:

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


To display information on the amount of requests you also have to edit file footer.tpl of your theme:


For example, Prestashop-based store that has more than 10 installed modules produces 123 requests on the product’s page with cache off and 113 requests with cache on: http://belvg.info/demo/prestashop16/breadcrumbs/en/blouses/2-blouse.html

1Speeding up Prestashop

footer.tpl

db.php

What were your results? Share your experience in the comments below!

Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *