News:

Looking for documentation? Take a look on our wiki

Main Menu

Virtuemart queries

Started by RubenR, April 04, 2014, 16:54:04 PM

Previous topic - Next topic

RubenR

I'm having troubles in a website that uses Virtuemart(2). If I enter a main category with a lot of products, it takes ages for the page to load. There are more than 1k products in this category, and Virtuemart tries to Query all off them. Even if the category view is set on 16 products.

If I look in the debug mode I see things like this:

1078 × SELECT ordering,id FROM  nsnpz_virtuemart_product_categories

1078 × SELECT * FROM nsnpz_virtuemart_product_prices

1078 × SELECT virtuemart_media_id FROM  nsnpz_virtuemart_product_medias


If I look deeper in all the queries, I see he is loading products on page number 17, even if I'm at page one.

This doesn't make any sense.. In total the page creates 10465 queries for 16 products on a page.

Does anyone else have this problem too? Or is there a way I can lower the amount of queries?

jjk

Quote from: RubenR on April 04, 2014, 16:54:04 PM
This doesn't make any sense.. In total the page creates 10465 queries for 16 products on a page.

In the category view, VM has to query all products in that category to be able to produce the paginated pages. The queries are usually very fast, but I think 10465 queries are not normal and I suppose your main bottleneck is somewhere else.
For comparison - in a category with 250 products I have 18 queries where your debug mode shows 1078.

Can you provide more information like exact Joomla and VM version, installed (VM) extensions, etc. and eventually a link to that site? 
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

RubenR

I'm using Joomla version 2.5.14 and Virtuemart version 2.0.22a.
I know there are a newer versions available, but we made some (simple) core hacks. I only want to update if I'm 100% sure if that solves anything.

We are also using the Filter module cf Filtering. But turning that module off doesn't help.

Maxim Pishnyak

Don't update live shop. Update on test version of your project and switch to standard template before counting queries.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

RubenR

I have found my problem.
The default category ordering was set on Product Sales. Because of that he was Querying all the product sales, for each product.
If I set the default product ordering from price, Low -> High, I only have around 1500 queries.