Large Database Querys slowing down the site

[ad_1]

Hey All, so im working on my site and its slow. The CPUs keeps maxing out with more the 5 people on it, currently i have 8CPU and 4GB of ram so its not a little server, when i look at Query Monitor i get these :-

||
||
|SELECT option_name, option_value FROM wp_rkpgy0apr3_options WHERE autoload IN ( 'yes', 'on', 'auto-on', 'auto' )|+wp_load_alloptions() |WordPress core|2647|0.5049|
|SELECT COUNT(DISTINCT comment_id) FROM wp_rkpgy0apr3_commentmeta WHERE meta_key = 'ivole_order' OR meta_key = 'ivole_order_locl'|+CR_Milestones->__construct() |Plugin: customer-reviews-woocommerce|1|0.1716|
|SELECT option_value FROM wp_rkpgy0apr3_options WHERE option_name LIKE 'wc_square_background_sync_job_%' AND ( option_value LIKE '%\"status\":\"queued\"%' OR option_value LIKE '%\"status\":\"processing\"%' ) ORDER BY option_id ASC LIMIT 1|+WooCommerce\S\F\U\Background_Job_Handler->get_job() |Plugin: woocommerce-square|0|0.5886|
|SELECT option_value FROM wp_rkpgy0apr3_options WHERE option_name LIKE 'wc_square_background_sync_job_%' AND ( option_value LIKE '%\"status\":\"queued\"%' OR option_value LIKE '%\"status\":\"processing\"%' ) ORDER BY option_id ASC LIMIT 1|+WooCommerce\S\F\U\Background_Job_Handler->get_job() |Plugin: woocommerce-square|0|0.3550|
|SELECT COUNT(*) FROM wp_rkpgy0apr3_comments WHERE ( ( comment_approved = '0' OR comment_approved = '1' ) ) AND user_id = 8068 AND comment_type != 'order_note' AND comment_type != 'webhook_delivery'|+WP_Comment_Query->get_comment_ids() |WordPress core|1|1.0244|
|SELECT SQL_CALC_FOUND_ROWS wp_rkpgy0apr3_users.ID,wp_rkpgy0apr3_users.display_name FROM wp_rkpgy0apr3_users INNER JOIN wp_rkpgy0apr3_usermeta ON ( wp_rkpgy0apr3_users.ID = wp_rkpgy0apr3_usermeta.user_id ) WHERE 1=1 AND ( wp_rkpgy0apr3_usermeta.meta_key = '_ywpar_user_total_points' ) ORDER BY wp_rkpgy0apr3_usermeta.meta_value+0 DESC LIMIT 0, 10|+WP_User_Query->query() |Plugin: yith-woocommerce-points-and-rewards-premium|10|2.2514|
|SELECT l.form_id, count(l.id) as unread_count FROM wp_rkpgy0apr3_gf_entry l WHERE is_read=0 AND status='active' GROUP BY form_id|+GFFormsModel::get_form_summary() |Plugin: gravityforms|1|0.1502|
|SELECT posts.ID, posts.post_title, comments.comment_author, comments.comment_author_email, comments.comment_ID, comments.comment_content FROM wp_rkpgy0apr3_comments comments LEFT JOIN wp_rkpgy0apr3_posts posts ON (comments.comment_post_ID = posts.ID) WHERE comments.comment_approved = '1' AND comments.comment_type = 'review' AND posts.post_password = '' AND posts.post_type = 'product' AND comments.comment_parent = 0 ORDER BY comments.comment_date_gmt DESC LIMIT 5;|+WC_Admin_Dashboard->recent_reviews() |Plugin: woocommerce|5|2.1062|
|SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id FROM wp_rkpgy0apr3_posts AS orders INNER JOIN wp_rkpgy0apr3_woocommerce_order_items AS order_items ON orders.ID = order_id INNER JOIN wp_rkpgy0apr3_woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id INNER JOIN wp_rkpgy0apr3_woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id WHERE orders.post_type IN ( 'shop_order' ) AND orders.post_status IN ( 'wc-completed','wc-processing','wc-on-hold' ) AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' AND orders.post_date_gmt >= '2024-08-01' AND orders.post_date_gmt <= '2024-08-15 11:48:16' GROUP BY product_id ORDER BY qty DESC LIMIT 1|+WC_Admin_Dashboard->get_top_seller() |Plugin: woocommerce|1|0.5821|

the database is big with 4.3 million records and 1.8GB, i have tried things like WP optimise all with no real change. I am at a loss of what else to do here apart from deleting old orders/images/customers

Thanks all

[ad_2]
2 Comments

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer