Home › Forums › General Issues › DB Query too long on Search
I am using WPEngine and on new searches I am getting a DB Error. It seems that WPEngine DB is not robust enough to handle the full request. So I am looking at getting some insight as too why ACF is adding sow much to the Query.
a simple search like http://www.mysite.com/?s=hello
Here is the Query:
# WordPress database error MySQL server has gone away for query
SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.ID
FROM wp_posts
LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )
WHERE 1=1
AND ( wp_postmeta.meta_key = 'active' AND wp_postmeta.meta_value = '1' )
AND (
(wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'companies' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'products_a' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'products_b' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'products_c' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'products_c' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'glossary' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'testimonials' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'types_a' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'types_b' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'newsletter' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'calculator' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'landing-page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'video' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
OR (wp_posts.post_type = 'reviews' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
)
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
LIMIT 0, 10
Can someone let me know if this looks accurate. Yes we do have a lot of custom post types and I don’t get this error on my local development although my local machine is more robust then WPEngines DB server. However, we are on a dedicated server and not a shared one.
Does anyone know the importance of each
OR (wp_posts.post_type = 'xxxxxxx' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))
Thanks
You’re going to have to contact the developers (WPEngine) on this one. The “acf-disabled” status is added by ACF and applied to field groups and fields when a field group is disabled. It should not be applied to queries for posts other than post types managed by ACF. In my mind this is a bug adding this post status to all post types. You can contact them here or open a ticket on your account.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.