Skip Navigation

[Closed] Slow Query

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1875733
select.jpg
select.jpg

I am trying to: Make Infinite scrolling fast
Link to a page where the issue can be seen:hidden link

I expected to see: Infinite scrolling is fast

Instead, I got: Infinite scrolling is very slow

#1875763

Hi, I'll be glad to take a closer look. It might be fastest if I can log in to wp-admin and see how this View is set up. Can you provide login credentials in the private reply fields here?

#1879309

Hi, I'm investigating this now and running some tests in the staging environment. I need to temporarily deactivate some other 3rd-party plugins, so you may notice some features are not working correctly in staging for a brief time. I will reactivate those plugins and revert the staging environment to its previous state when I'm done. Stand by and I will give you some feedback shortly.

#1879341
Screen Shot 2020-12-17 at 8.37.57 AM.png

There's a lot going on here, and I'm not sure how much we will be able to improve the speed of these AJAX queries because of the complexity of the View and the site setup. I've created a very simple test View of Products with infinite scrolling and placed it in a test page here:
hidden link

You can see the View in wp-admin here:
hidden link

To perform the simple test, I made the following changes:
- I turned off all other plugins except the SSL plugin, Types, Views and WooCommerce.
- I removed all filters from the View
- I unchecked "Don't include current page in query results", which isn't necessary here
- I turned off caching and preloading in the pagination options
- I turned off the Custom Search option "Show only available options for each input"
- I replaced the loop contents with a simple post link

When I test the infinite scroll AJAX request, it usually runs from 1 - 2 seconds or less. See the screenshot attached here from a very simple setup. So the baseline AJAX request is not unusually slow, but as each additional plugin, element, or Views feature is added back, the request time increases. Some increase in query time should be expected as more and more processing is required for each new element or feature introduced.

Realistically, infinite scrolling is not ideal in your current setup because of the complexity involved in each query. A different pagination method will provide a better experience when many custom field filters and multiple taxonomy filters are offered along with results that include complex content.

If Infinite Scrolling is an absolute requirement, sacrificing some features or filters will make the experience faster, since each feature and filter adds more time to the query request. You could consider these options to improve query speed:
- Eliminate the need for other plugins as much as possible. Insert the View directly in the page contents instead of building the page with Elementor.
- Optimize the filters by limiting the number of custom field filters. Taxonomy filters are always faster than custom field filters because of how WordPress's database is designed, so if you can replace any of these custom fields with taxonomies, the query time will improve.
- Optimize the filters by removing the post count from each filter option, since that value must be calculated repeatedly during uncachable View queries.
- Optimize the filters by disabling the "Show only available options for each input" feature in Custom Search settings in the View.
- Provide one infinite scrolling View with limited filters and features, and provide an alternate custom search View without infinite scrolling where Users have access to all the features and filters that slow down queries.
- Uncheck "Don't include current page in query results" in the View.
- Turn off caching and preloading in Pagination settings in the View.
- Optimize the loop contents by limiting the number of conditionals and custom shortcodes that must be evaluated for each result.
- Optimize the loop contents by eliminating the loop template shortcode, and place the contents of that template directly in the loop editor.
- Consider asking your host company to upgrade your MySQL database, which may lead to query performance improvements.

The topic ‘[Closed] Slow Query’ is closed to new replies.