Very Slow Loads and Long Query times on Dashboard
-
Hey There,
When the plugin is active, it takes very long to load the main dashboard and the query times are very long (checked in query monitor).
What would you suggest to help curb this problem and make the plugin more faster and responsive. I’ve separate db server with good specs so the db doesn’t seem to the bottleneck.
The Query is as follows:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1
AND wp_posts.post_type = ‘amp_validated_url’
AND (wp_posts.post_status = ‘publish’
OR wp_posts.post_status = ‘acf-disabled’
OR wp_posts.post_status = ‘paused’
OR wp_posts.post_status = ‘active’
OR wp_posts.post_status = ‘queued’
OR wp_posts.post_status = ‘finished’
OR wp_posts.post_status = ‘future’
OR wp_posts.post_status = ‘draft’
OR wp_posts.post_status = ‘pending’
OR wp_posts.post_status = ‘private’)
AND (
SELECT 1
FROM wp_term_relationships
INNER JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
INNER JOIN wp_terms
ON wp_terms.term_id = wp_term_taxonomy.term_id
WHERE wp_term_taxonomy.taxonomy = ‘amp_validation_error’
AND wp_term_relationships.object_id = wp_posts.ID
AND wp_terms.term_group IN ( 0, 1 )
LIMIT 1 )
ORDER BY wp_posts.post_date DESC
LIMIT 0, 12The Caller is:
WP_Query->get_posts
WP_Query->query
WP_Query->__construct
AMP_Validated_URL_Post_Type::filter_dashboard_glance_items
WP_Hook->apply_filters
apply_filters(‘dashboard_glance_items’)
wp_dashboard_right_now
do_meta_boxes
wp_dashboardThank you so much for the great plugin and your help.
-
If you’d like to share your Site Health Information we can inspect your setup.
You might also be interested to try out the release candidate for version 2.0, which brings performance improvements, some of which you’ll find tagged in the 2.0 milestone.
Hey @jamesosborne,
Thank you so much for the quick trun around, I’m adding the site health info below:
### wp-core ### version: 5.5 site_language: en_US user_language: en_US timezone: America/Los_Angeles permalink: /%postname%/ https_status: true user_registration: 1 blog_public: 1 default_comment_status: open multisite: false user_count: 97 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /var/www/ed wordpress_size: 115.38 MB (120982870 bytes) uploads_path: /var/www/ed/wp-content/uploads uploads_size: 5.77 GB (6192796804 bytes) themes_path: /var/www/ed/wp-content/themes themes_size: 2.45 MB (2566621 bytes) plugins_path: /var/www/ed/wp-content/plugins plugins_size: 100.72 MB (105607768 bytes) database_size: 256.04 MB (268481333 bytes) total_size: 6.23 GB (6690435396 bytes) ### wp-dropins (3) ### advanced-cache.php: true db.php: true object-cache.php: true ### wp-active-theme ### name: EDGermanMain (EDGermanMain) version: 1.0 author: Aaryan Sharma author_website: (undefined) parent_theme: Twenty Twenty (twentytwenty) theme_features: core-block-patterns, automatic-feed-links, custom-background, post-thumbnails, custom-logo, title-tag, html5, align-wide, responsive-embeds, customize-selective-refresh-widgets, editor-color-palette, editor-font-sizes, editor-styles, amp, widgets, menus, editor-style theme_path: /var/www/ed/wp-content/themes/EDGermanMain auto_update: Disabled ### wp-parent-theme ### name: Twenty Twenty (twentytwenty) version: 1.5 author: the WordPress team author_website: https://wordpress.org/ theme_path: /var/www/ed/wp-content/themes/twentytwenty auto_update: Disabled ### wp-mu-plugins (1) ### ManageWP - Worker Loader: author: GoDaddy, version: (undefined) ### wp-plugins-active (45) ### Ad Inserter: version: 2.6.11, author: Igor Funa, Auto-updates disabled AdThrive Ads: version: 1.0.40, author: AdThrive, Auto-updates disabled Advanced Custom Fields PRO: version: 5.9.0, author: Elliot Condon, Auto-updates disabled Alexa Certify: version: 4.1.2, author: Alexa Internet, Auto-updates disabled AMP: version: 1.5.5, author: AMP Project Contributors, Auto-updates disabled AMP Stories for WordPress: version: 1.3.2, author: Aaryan Sharma, Auto-updates disabled Better Search Replace: version: 1.3.3, author: Delicious Brains, Auto-updates disabled Block Lab: version: 1.5.6, author: Block Lab, Auto-updates disabled Broken Link Checker for YouTube: version: 1.2, author: Super Blog Me, Auto-updates disabled Contact Form 7: version: 5.2.1, author: Takayuki Miyoshi, Auto-updates disabled Cookie Notice: version: 1.3.2, author: dFactory, Auto-updates disabled ED Shows: version: 1.1.0, author: Aaryan Sharma, Auto-updates disabled Favorites: version: 2.3.2, author: Kyle Phillips, Auto-updates disabled Flamingo: version: 2.2, author: Takayuki Miyoshi, Auto-updates disabled Inline Spoilers: version: 1.5.1, author: Sergey Kuzmich, Auto-updates disabled Insert Headers and Footers: version: 1.4.6, author: WPBeginner, Auto-updates disabled jQuery Updater: version: 3.5.1.2, author: Ramoonus, Auto-updates disabled LuckyWP Table of Contents: version: 2.1.4, author: LuckyWP, Auto-updates disabled Mailster - Email Newsletter Plugin for WordPress: version: 2.4.13, author: EverPress, Auto-updates disabled Mailster SendGrid Integration: version: 2.0.2, author: EverPress, Auto-updates disabled ManageWP - Worker: version: 4.9.7, author: GoDaddy, Auto-updates disabled Post Category Filter: version: 1.6.1, author: Javier Villanueva, Auto-updates disabled Query Monitor: version: 3.6.3, author: John Blackbourn, Auto-updates disabled Really Simple SSL: version: 3.3.4, author: Really Simple Plugins, Auto-updates disabled Redirection: version: 4.8, author: John Godley, Auto-updates disabled Schema Pro: version: 2.1.2, author: Brainstorm Force, Auto-updates disabled Search & Filter: version: 1.2.12, author: Designs & Code, Auto-updates disabled Simple Comment Editing: version: 2.5.1, author: Ronald Huereca, Auto-updates disabled String Locator: version: 2.4.1, author: Clorith, Auto-updates disabled Superb Social Share and Follow Buttons: version: 101.0, author: SuPlugins, Auto-updates disabled The SEO Framework: version: 4.1.0, author: The SEO Framework Team, Auto-updates disabled The SEO Framework - Extension Manager: version: 2.4.0, author: The SEO Framework Team, Auto-updates disabled Ultimate Member: version: 2.1.7, author: Ultimate Member, Auto-updates disabled Ultimate Member - Maybe load assets: version: 1.0.2, author: Ultimate Member, Auto-updates disabled Ultimate Member - reCAPTCHA: version: 2.1.6, author: Ultimate Member, Auto-updates disabled Ultimate Member - Social Login: version: 2.3.3, author: Ultimate Member, Auto-updates disabled User Role Editor Pro: version: 4.57, author: Vladimir Garagulia, Auto-updates disabled W3 Total Cache: version: 0.14.4, author: BoldGrid, Auto-updates disabled Wicked Folders: version: 2.17.3, author: Wicked Plugins, Auto-updates disabled Wordfence Security: version: 7.4.10, author: Wordfence, Auto-updates disabled WP External Links: version: 2.46, author: WebFactory Ltd, Auto-updates disabled WP File Manager: version: 6.6, author: mndpsingh287, Auto-updates disabled WP Import Export Lite: version: 3.0.1, author: VJInfotech, Auto-updates disabled WP Mail SMTP: version: 2.3.1, author: WPForms, Auto-updates disabled WP YouTube Lyte: version: 1.7.13, author: Frank Goossens (futtta), Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1690 imagemagick_version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org file_uploads: File uploads is turned off post_max_size: 8M upload_max_filesize: 8M max_effective_size: 8 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 122 MB imagick::RESOURCETYPE_DISK: 1073741824 imagick::RESOURCETYPE_FILE: 768 imagick::RESOURCETYPE_MAP: 512 MB imagick::RESOURCETYPE_MEMORY: 256 MB imagick::RESOURCETYPE_THREAD: 1 gd_version: 2.3.0 ghostscript_version: 9.50 ### wp-server ### server_architecture: Linux 5.4.0-40-generic x86_64 httpd_software: nginx/1.18.0 php_version: 7.4.9 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 180 memory_limit: 256M max_input_time: 360 upload_max_size: 8M php_post_max_size: 8M curl_version: 7.68.0 OpenSSL/1.1.1g suhosin: false imagick_availability: true pretty_permalinks: true ### wp-database ### extension: mysqli server_version: 10.5.5-MariaDB-1:10.5.5+maria~focal client_version: mysqlnd 7.4.9 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/www/ed/wp-content WP_PLUGIN_DIR: /var/www/ed/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### luckywp-table-of-contents ### domVersion: 20031129 libxmlVersion: 2.9.10 intlVersion: 7.4.9 icuVersion: 66.1 settings: {"lwptoc_general":{"min":"2","depth":"3","hierarchical":true,"numeration":"none","numerationSuffix":"none","title":"Table of Contents","toggle":false,"labelShow":"show","labelHide":"hide","hideItems":false,"smoothScroll":false,"smoothScrollOffset":"24"},"lwptoc_appearance":{"width":"auto","float":"none","titleFontSize":"90%","titleFontWeight":"semibold","itemsFontSize":"80%","colorScheme":"light","backgroundColor":null,"borderColor":null,"titleColor":"#000000","linkColor":"#000000","hoverLinkColor":null,"visitedLinkColor":null},"lwptoc_autoInsert":{"enable":false,"position":"beforefirstheading","postTypes":["post"]},"lwptoc_processingHeadings":{"postTypes":["post"]},"lwptoc_misc":{"skipHeadingLevel":"","skipHeadingText":"","hashFormat":"asheading","hashConvertToLowercase":false,"hashReplaceUnderlinesToDashes":true,"wrapNoindex":true,"useNofollow":true,"showMetaboxPostTypes":"","listMarkupTags":"div","containerClass":""}} ### wp_mail_smtp ### version: 2.3.1 license_key_type: lite debug: No debug notices found. db_tables: wp_wpmailsmtp_tasks_meta ### amp_wp ### amp_mode_enabled: transitional amp_templates_enabled: post, is_singular, is_home amp_serve_all_templates: false amp_css_transient_caching_disabled: n/a amp_css_transient_caching_threshold: 5000 transients per day amp_css_transient_caching_sampling_range: 14 days amp_css_transient_caching_transient_count: undefined amp_css_transient_caching_time_series:
As for the 2.0 release candidate, I’m not really sure about testing that out on a production website, I hope you understand😅
Please let me know if you need any other info, also, I’ve tested this without W3 Total Cache as well, the same query is shown as slow and the dashboard loads slowly.
Thank you so much for your help.
-
This reply was modified 1 year, 1 month ago by
aaron13223. Reason: spelling mistake
Hey,
I really don’t want to see the dashboard glance items and I was looking how to remove the filter.
I could remove it by editing amp/includes/validation/class-amp-validated-url-post-type.php and commenting:
add_filter( ‘dashboard_glance_items’, [ __CLASS__, ‘filter_dashboard_glance_items’ ] );
But, I really don’t want to edit the plugin like this. I tried using remove_filter but that doesn’t seem to work.
I would be happy by removing this or any other solution you provide.
Thanks a bunch.
Thanks for reporting this. There definitely shouldn’t be a slow query here.
How many posts with the
amp_validated_url
exist on your site? How manyamp_validation_error
taxonomy terms?Aside: we need to include these in the Site Health info.
-
This reply was modified 1 year, 1 month ago by
Weston Ruter.
Hey @westonruter,
Thank you so much for the continued help and support.
I just checked and there are 178 amp_validated_url and 2,115 amp_validation_error in which all of em have been removed.
Hope this helps. For now I’ve disabled the ‘filter_dashboard_glance_items’ filter and the query no longer runs on the dashboard.
But I think that might not be a appropriate solution. What are your thoughts about this? If removing the filter is the solution for now, I’d be happy to close the topic. Thanks a bunch.
Removing the filter is a good temporary workaround. We’ll investigate and put in place a proper fix.
Okay, Thank you so much for your help.
Really grateful for the help provide by both of you. @westonruter @jamesosborne
Thanks alot again.
You should be able to remove the filter without modifying the plugin via the following remove_filter call:
remove_filter( 'dashboard_glance_items', [ 'AMP_Validated_URL_Post_Type', 'filter_dashboard_glance_items' ] );
However, I’d like to look into what is causing the slow SQL execution in this case, so I’d also be grateful for any additional information you could provide:
– How long does the query actually take to execute in your case?
– Are you able to run SQL queries directly against the database, for example via WP-CLI’sdb query
command?
If yes, can you run the above query by pretending theEXPLAIN
keyword? This will gives us details about how the database server goes about resolving this query.
As an example, here’s what it does on my machine: https://share.getcloudapp.com/8LuPo5ypSeeing this would be hugely helpful, because I suspect there might be an indexing issue on your server.
Thanks for helping us get to the bottom of this!
Hey @schlessera,
Really sorry for the delayed response. The filter that you provided doesn’t seem to work, I still have the filter removed in the plugin file.
– I’m attaching the image for the query execution: https://ibb.co/QND2zQJ
– I’m not really good at using wp-cli, so is that necessary?, if it is, I can learn it up and have the screenshot attached as well.As you’ve said about the indexing issue, It might actually be the problem, do you suggest a way to have this checked or a way to fix the indexing so the test can be conducted again? What do you suggest to fix the indexing if the issue actually exists.
Again, thank you so much for your continued support and help.
@aaron13223 Do you have access to phpMyAdmin or some other MySQL UI? You can run the
EXPLAIN
command there as well.Hey @westonruter,
I just ran this query in mysql: EXPLAIN SELECT SQL_CALC_FOUND_ROWS id from wp_posts;
Here’s the screenshot: https://prnt.sc/u43gio
Do you want me to run the full query? If so, can you please share the query and I’ll try running that.
Thanks for your help.
Yes, please run the full query that was flagged as being slow. It’s the query you first screenshotted in Query Monitor.
Oh ohkay, I just misunderstood. I ran the query which was being marked as slow and took the screenshot.
Take a look: https://prnt.sc/u43n8x
Thanks again.
-
This reply was modified 1 year ago by
aaron13223. Reason: spelling mistake
@aaron13223 The query itself seems to run as fast as expected on its own (0.001 sec on your MariaDB screenshot), and the
EXPLAIN
does not show any immediate issues as far as I can see.However, on your QueryMonitor screenshot, I can see that the query runs through an extra DBCache (probably via W3TotalCache?). Have you tried disabling that DBCache to see whether that fixes the issue?
Hey @schlessera,
Yes, I’ve tried disabling W3 Total Cache but it still runs slow for some reason. I also tried disabling everything except AMP & Query Monitor, yet it was still slow.
I’m at a loss here, do you wish see any other information that could help you?
Thank you so much for your help.
-
This reply was modified 1 year, 1 month ago by
- The topic ‘Very Slow Loads and Long Query times on Dashboard’ is closed to new replies.