Page 1 of 1

[Solved] SQL Help Please!

Posted: Sun May 09, 2021 2:15 pm
by zaidladha
Hi,

Can anyone help me identify what could be using this SQL statement? Unforunately I don't get much info from the slow query log that a2hosting is giving me. We are on their prestige VPS so I am not sure why we are maxing out the resources. This query stands out as taking long as it runs against all 80,000 products. I have no clue what is triggering it. www.stevestonmarine.com and on opencart 2.3.0.2

SELECT p.product_id, p.sort_order FROM oc_product p LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id AND pd.language_id = 1) LEFT JOIN oc_product_to_store p2s ON (p.product_id = p2s.product_id AND p2s.store_id = 0) LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN oc_category_description cd ON (p2c.category_id = cd.category_id) LEFT JOIN oc_manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.date_available <= NOW() AND p.status = 1 AND ((p.product_id =

Re: SQL Help Please!

Posted: Sun May 09, 2021 3:20 pm
by thekrotek
Looks like a generic query to get products.

Re: SQL Help Please!

Posted: Sun May 09, 2021 7:59 pm
by by mona
Why are you using the owl carousel for static images ? Total waste of valuable resources - both the carousel and the slideshow are very heavy to load and completely unnecessary for static images. You also have quite a lot of work to do on performance generally.

Use static images via custom html.
If you dont know how to do that - I have two modules that are very light and will do it for you - the first does loads of amazing stuff - the second can be used as a slideshow and per category/product. Both do what you want lightly.
https://www.opencart.com/index.php?rout ... n_id=33048
https://www.opencart.com/index.php?rout ... n_id=26852

However, it is so easy to do it by yourself.

Code: Select all

<div class="col-xs-12"><a href='xx'><img src="https://xxx.jpg" alt="xx" title="xx" class="xx"></a></div>
Remember to compress your images

Re: SQL Help Please!

Posted: Mon May 10, 2021 6:41 pm
by paulfeakins
zaidladha wrote:
Sun May 09, 2021 2:15 pm
Can anyone help me identify what could be using this SQL statement?
You probably need a developer to have a look.

Re: SQL Help Please!

Posted: Thu May 20, 2021 11:57 pm
by halfhope
Hi!
This is not standart query from some module (most probably multiple-featured, that you use). This query (also as model_catalog_product->getProducts($data)) scans all records on database and getting result, and this is fine. To increase perfomance (not scan all records) SQL query shoud use index fields or woud be cached. I can help you with that.

Re: SQL Help Please!

Posted: Fri Jul 23, 2021 1:56 pm
by zaidladha
by mona thanks for the tip! I have gone ahead and added it in usingly slightly different code. I didn't use the div and just went with the full width.

I think I figured out the module that was causing the issue, Product Labels Advanced.

Thanks for the help everyone!