VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Zegenrijk on December 09, 2014, 08:58:50 AM

Title: Calc rules queries very very slow /_virtuemart_calc_
Post by: Zegenrijk on December 09, 2014, 08:58:50 AM
Hello,

I have a lot of rules in 'Tax & Calc rules'....(8008 rules, different discounts in different categories). The frontend website is very very slow. So i investigated the Joomla error console and noticed that calling a virtuemart category page there are **40569 queries logged**. WOW, that's a lot!

Further investigation i noticed that this are the big ones:
**8008 × SELECT `virtuemart_country_id`
  FROM b51v3_virtuemart_calc_countries**
**8008 × SELECT `virtuemart_shoppergroup_id`
  FROM b51v3_virtuemart_calc_shoppergroups**
**8008 × SELECT `virtuemart_state_id`
  FROM b51v3_virtuemart_calc_states**
**8008 × SELECT `virtuemart_category_id`
  FROM b51v3_virtuemart_calc_categories**
**8008 × SELECT `virtuemart_manufacturer_id`
  FROM b51v3_virtuemart_calc_manufacturers**

So, without many knowledge of queries/databases i think it's not a good thing to call every rule in a table one by one in a select.  This is the main problem...

I can provide a url (not in the forum...). I'm using latest VM2 and tried VM3, same problem.

How to solve?

Regards Michel
Title: Re: Calc rules queries very very slow / bad coding /_virtuemart_calc_
Post by: Milbo on December 11, 2014, 14:22:34 PM
Interesting, yeh of course this is not an heavily optimised part, because most people have not more than 10 rules. You may write to me your login. Maybe I can find a fst solution to prevent the worst.