Too many DB queries for _conditions table when...

Search
Other Bug Reports questions
Forum

Too many DB queries for _conditions table when using AMM on J4

Gary Brindley's Avatar Gary Brindley
We do still have hundreds of condition sets, but we can see that the process has correctly implemented those conditions on multiple modules

I think the issue is really that we have a lot of modules on this website that each have unique assignments. Modules that are intended to be shown on a single, specific article, but x100-200.

Is it fair to deduce then that AMM is simply not suitable if you have lots (hundreds) of modules each with unique assignments? The speed difference if we disable all modules except those on the homepage is very noticeable.

If there's something we can do to the rules to improve this huge query overhead then we'll do it. But if you don't think there is a solution to our usage of AMM that's fine too - would just like to hear it come from you.
Peter van Westen's Avatar Peter van Westen ADMIN
The way the Conditions work with AMM, it is indeed so that each different assignment needs to be separately checked. So yeah, I don't see a quick and easy way to change that.

The reason the core module manage can deal with simple menu assignments in an easier and quicker way, is that that is all it needs to worry about.
AMM doesn't know if a module only has a menu assignment up front, and cannot assume that. So it needs to check what condition rules are set in each Condition Set. And it can't do that in the same query that collects all the modules.

BTW: Have you checked what the effect is of using conservative caching on the site?
I see you are currently not using caching at all.
Please post a rating at the Joomla! Extensions Directory
Andrea Malalana's Avatar Andrea Malalana ADMIN
And PS:
I think the issue is really that we have a lot of modules on this website that each have unique assignments. Modules that are intended to be shown on a single, specific article, but x100-200.

Can you explain the exact use-case and necessity of having individual modules meant for individual articles? I'm not sure this is very efficient or manageable, maybe there is a better way you could set your modules up. What is the use-case you have them for?
Gary Brindley's Avatar Gary Brindley
Thanks guys appreciate the feedback here. No problem Peter, I suspected as much. Not complaining, only wanted to understand.

Caching is next on our list to check out. Historically we've had very bad luck with Joomla caching. We use RSJoomla extensions and with joomla cache enabled, RSForm stops functioning properly. Among a few other anomalies we witness - it's also risky enabling this on a site this large as it's hard to ensure all aspects continue to function correctly ( a lot of our issues here are due to needing to migrate to J4 ) .
Can you explain the exact use-case and necessity of having individual modules meant for individual articles? I'm not sure this is very efficient or manageable, maybe there is a better way you could set your modules up. What is the use-case you have them for?

Consider something like

You have an online store with 400 product pages.
On those product pages, you want to show user reviews which are stored as articles.
You have an articles category module per product page to filter the correct review article from the reviews category by tag.

You are absolutely right that there is probably a better way to do this with development, but at the time the website was developed we were unaware of the eventual impact this approach would have, especially when you introduce parameters like Clients who use the CMS themselves.

I can already think of a few ways to do this without the module overhead so we are going to experiment and see if changing how this is done, removing the need for so many modules, has enough of an impact.

Realistically though this is going to be an issue at scale anyway. It's unlikely a large website is going to be primarily shared assignment rules. But I do expect AMM's usage in this context is a minority figure.
Peter van Westen's Avatar Peter van Westen ADMIN
By the sound of it you could create one module to rule them all!

I mean, place some code in a single module that collects the category or tag you need based on the current item.
Then output the articles from that category or by that tag, using Articles Anywhere for instance.

Then you just need 1 module that shows up on all your product pages.

Generally speaking, I do not think that even big sites would need hundreds of different Condition Sets to control their modules. If they do (like in your case) it kinda indicates that there should be a much easier way to do things.

Even storing all the different reviews in separate articles seems like a bit of a management-intensive way to approach things.
If all you want to do is display those reviews (and not want full article functionalities on them, like linking to individual reviews), then maybe you can simply store them in a custom field attached to the product itself. If your shop extension supports that of course.

Or alternatively just have a single article per product, which contains a custom field (subform) in which you can place all the reviews.
Please post a rating at the Joomla! Extensions Directory
Gary Brindley's Avatar Gary Brindley
I agree, and your trailing point is almost exactly how I planned to solve it (custom field against the product article that lets you select review articles.)

The issue is more that we have many websites this large, that have been used by clients for several years. Of course I was hoping for an easy fix 😉

Really appreciate the help and input here Peter. I'm glad at least we helped resolve a condition migration bug.
You can only post on this forum if you log in