4 long running queries I need to override

4.24K viewsIssues
0

Rahul.  Here they are along with row numbers and times.

SELECT count(*) as count, p.post_status
FROM wp_posts p
INNER JOIN wp_ap_qameta qameta
ON p.ID = qameta.post_id
WHERE p.post_status NOT IN (‘trash’, ‘draft’)
AND p.post_type = ‘question’
AND qameta.flags > 0
GROUP BY p.post_status
ap_total_posts_count()
wp-content/plugins/anspress/includes/functions.php:748
+ Plugin: anspress 0 2.0631
SELECT count(*) as count, p.post_status
FROM wp_posts p
INNER JOIN wp_ap_qameta qameta
ON p.ID = qameta.post_id
WHERE p.post_status NOT IN (‘trash’, ‘draft’)
AND p.post_type = ‘answer’
AND qameta.flags > 0
GROUP BY p.post_status
ap_total_posts_count()
wp-content/plugins/anspress/includes/functions.php:748
+ Plugin: anspress 0 2.0062
SELECT post_status, COUNT( * ) AS num_posts
FROM wp_posts
WHERE post_type = ‘question’
GROUP BY post_status
wp_count_posts()
wp-includes/post.php:2213
+ Plugin: anspress 1 5.0544
SELECT post_status, COUNT( * ) AS num_posts
FROM wp_posts
WHERE post_type = ‘answer’
GROUP BY post_status
wp_count_posts()
wp-includes/post.php:2213
+ Plugin: anspress 1 4.4439

0

This is still partially an issue but I’m going to mark as resolved.  One work around I found with all anspress scale issues with nginx is that if you are using nginx you need to add a line in the nginx.conf that prevents blocking -aio threads; .  Between doing that and adding redis it seems that this will scale enough.  The count(*) queries though across all the posts don’t really serve a purpose and are not great on innodb since they result in full table scans.

commented on answer

Thanks for the update. Yes its feels like that using count does not improve anything. I am thing to revert it.