Hello,
I use Toolset for years and now my website is almost build with your plugins only.
Recently I noticed some bad performances so I installed Query Monitor and you can see that View is the problem of my bad performances
wpcf_image_is_attachment() is a big problem because I understand that this query is used to found an image that will be displayed on the page, but I noticed that some queries are looking for images that are not in loaded the page.
My posts have post-type childs, and while I want to display the post only, the queries wpcf_image_is_attachment() are looking for the images of all the childs while they are not called.
For exemple :
SELECT ID
FROM p2u_posts
WHERE post_type = 'attachment'
AND guid='hidden link'
LIMIT 1
That query took 0,2174sec to load while the image is not visible on that page.
Do you know if I can speed up my website ?
Thanks
Hi, can you include more information about your View so I can investigate?
- Take some screenshots that show the View editor screen in wp-admin so I can see your settings, and add those images in your reply here.
- Are you using any nested Views inside the parent post type View? If so, please take screenshots of the nested Views as well.
- How is the image hidden link added to a child post? Is it a custom field, or in the post content, or a featured image, etc?
I'll take a look and see what we can do to help speed things up.
Thanks for your reply.
The way I use Toolset may be a little bit complex and I need to explain how I use it.
I have posts, each post have childs that are products to affiliate websites. I need to add an affiliate link in a field to redirect the visitor to the product. Those links need to be cloaked to be understood by the affiliate plateform that I'm the referral.
ex : hidden link
where XXXXXXXXXXXXX is what I enter in the field in the child post
So I use a template to create the affiliate links. If website is AAAA so use this cloaked link structure, if the affiliate website is BBBB so use that cloaked link structure.
I tried to explain all in the screenshot joined.
--------------------------
Moreover I tried the option "add resized images to library", It solved a part of the problem because the wpcf_image_is_attachment() queries are not asked anymore but view is still the plugin that load the more content.
You will see the difference of perf in the screenshot liked. I added another screenshot of the slowest queries to know if its normal or not.
What are the incidences of the option "add resized images to library" ? In general do you have better performances when the option is cheked ?
Thanks
What are the incidences of the option "add resized images to library" ? In general do you have better performances when the option is cheked ?
In general yes, you will have better performance because after the resized image has been rendered once it's saved to the library for future use. The server does not need to calculate and generate a resized image on each page load - it stores a reference to the image in your database and loads the resized image from the uploads folder. This creates an image attachment link in the database, so if you add 10 resized images to each post your database queries of image attachments will be incrementally slower as it needs to sort through more records. That's the trade-off.
It solved a part of the problem because the wpcf_image_is_attachment() queries are not asked anymore but view is still the plugin that load the more content.
When testing performance, we try to ensure that no single query takes longer than 0.5ms. If you have any single query that takes longer than 0.5ms, then we should try to investigate that query. Looking at the total time spent by all queries per component isn't always helpful, because the optimization of queries also depends on how your Views are structured. For example, in your "homepage template" image, I can see that you use id="$parent" to get the featured image of the parent post in each loop iteration. To get parent information in a loop showing child posts, WordPress must make another query in each iteration of the loop. This isn't optimal, but unfortunately it's unavoidable when you need to access data from another post within the loop of a View.
OK it's clear.
Thanks for your reply.