Ускорить работу сайта на Wordpress

1 500 руб. за проект
11 января 2025, 15:47 • 4 отклика • 40 просмотров
Здравствуйте!

Имеется сайт - https://library-poems.com/ и создано уже более 12 тисяч записей, начал плохо работать, очень редко выскакивает ошибка что не может подключиться к базе даных. Установил плагин Query Monitor и заметил что есть медленные запросы к базе данных:

Запрос: (Ядро WordPress)

SELECT wpzc_posts.ID
FROM wpzc_posts
LEFT JOIN wpzc_term_relationships
ON (wpzc_posts.ID = wpzc_term_relationships.object_id)
INNER JOIN wpzc_postmeta
ON ( wpzc_posts.ID = wpzc_postmeta.post_id )
WHERE 1=1
AND ( wpzc_term_relationships.term_taxonomy_id IN (31) )
AND ( wpzc_postmeta.meta_key = '_thumbnail_id' )
AND wpzc_posts.post_type = 'post'
AND ((wpzc_posts.post_status = 'publish'))
GROUP BY wpzc_posts.ID
ORDER BY RAND()
LIMIT 0, 6

Вызывающий:
  1. WP_Query->get_posts()
    wp-includes/class-wp-query.php:3357
  2. WP_Query->query()
    wp-includes/class-wp-query.php:3852
  3. get_posts()
    wp-includes/post.php:2541
  4. load_template('wp-content/themes/root/template-parts/slider-posts.php')
    wp-includes/template.php:812
  5. locate_template()
    wp-includes/template.php:745
  6. get_template_part('template-parts/slider','posts')
    wp-includes/general-template.php:206
Запрос: (Тема)
SELECT wpzc_posts.ID
FROM wpzc_posts
INNER JOIN wpzc_postmeta
ON ( wpzc_posts.ID = wpzc_postmeta.post_id )
WHERE 1=1
AND ( wpzc_posts.ID NOT IN (
SELECT object_id
FROM wpzc_term_relationships
WHERE term_taxonomy_id IN (31,374,618,910,1059) ) )
AND ( wpzc_postmeta.meta_key = 'views' )
AND wpzc_posts.post_type = 'post'
AND ((wpzc_posts.post_status = 'publish'))
GROUP BY wpzc_posts.ID
ORDER BY wpzc_postmeta.meta_value+0 DESC
LIMIT 0, 5

Вызывающий:
  1. WP_Query->get_posts()
    wp-includes/class-wp-query.php:3357
  2. WP_Query->query()
    wp-includes/class-wp-query.php:3852
  3. get_posts()
    wp-includes/post.php:2541
  4. Wpshop_Widget_Articles->widget()
    wp-content/themes/root/inc/widgets/widget-articles.php:163
  5. WP_Widget->display_callback()
    wp-includes/class-wp-widget.php:394
  6. dynamic_sidebar('sidebar-1')
    wp-includes/widgets.php:845
  7. load_template('wp-content/themes/root/sidebar.php')
    wp-includes/template.php:810
  8. locate_template()
    wp-includes/template.php:745
  9. get_sidebar()
    wp-includes/general-template.php:136
Запрос: (Тема)
SELECT wpzc_posts.ID
FROM wpzc_posts
LEFT JOIN wpzc_term_relationships
ON (wpzc_posts.ID = wpzc_term_relationships.object_id)
INNER JOIN wpzc_postmeta
ON ( wpzc_posts.ID = wpzc_postmeta.post_id )
WHERE 1=1
AND ( wpzc_term_relationships.term_taxonomy_id IN (31,374,618,910,1059) )
AND ( wpzc_postmeta.meta_key = 'views' )
AND wpzc_posts.post_type = 'post'
AND ((wpzc_posts.post_status = 'publish'))
GROUP BY wpzc_posts.ID
ORDER BY wpzc_postmeta.meta_value+0 DESC
LIMIT 0, 5

Вызывающий:
  1. WP_Query->get_posts()
    wp-includes/class-wp-query.php:3357
  2. WP_Query->query()
    wp-includes/class-wp-query.php:3852
  3. get_posts()
    wp-includes/post.php:2541
  4. Wpshop_Widget_Articles->widget()
    wp-content/themes/root/inc/widgets/widget-articles.php:163
  5. WP_Widget->display_callback()
    wp-includes/class-wp-widget.php:394
  6. dynamic_sidebar('sidebar-1')
    wp-includes/widgets.php:845
  7. load_template('wp-content/themes/root/sidebar.php')
    wp-includes/template.php:810
  8. locate_template()
    wp-includes/template.php:745
  9. get_sidebar()
    wp-includes/general-template.php:136

Иногда бывает больше, иногда бывает меньше медленных запросов, но все связаны из wpzc_posts

Тема на форуме где пытались мне помочь - https://qna.habr.com/q/1385542