Please I have a very slow query on my wordpress search, checking the processes it takes upto 40sec to execute using SHOW FULL PROCESSLIST;
below is a sample of query
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Industreet%') OR (wp_posts.post_excerpt LIKE '%Industreet%') OR (wp_posts.post_content LIKE '%Industreet%'))) AND (wp_posts.post_password = '') AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.post_title LIKE '%Industreet%' DESC, wp_posts.post_date DESC LIMIT 0, 25
I have tried my best to fix this, but nothing is working out. though I have a total post of 120k on my site. I really need help.
Thanks in advance
Please I have a very slow query on my wordpress search, checking the processes it takes upto 40sec to execute using SHOW FULL PROCESSLIST;
below is a sample of query
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Industreet%') OR (wp_posts.post_excerpt LIKE '%Industreet%') OR (wp_posts.post_content LIKE '%Industreet%'))) AND (wp_posts.post_password = '') AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.post_title LIKE '%Industreet%' DESC, wp_posts.post_date DESC LIMIT 0, 25
I have tried my best to fix this, but nothing is working out. though I have a total post of 120k on my site. I really need help.
Thanks in advance
Share Improve this question edited Sep 11, 2018 at 5:32 fuxia♦ 107k39 gold badges255 silver badges461 bronze badges asked Sep 11, 2018 at 4:59 Godwin Alex OgbondaGodwin Alex Ogbonda 1192 silver badges13 bronze badges 2 |2 Answers
Reset to default 1This is the query generated by the internal search function on Wordpress.
It is criticised for being inefficient, and there are a few drop-in replacements available as plugins. You may be able to find something that helps you by doing more research around these. For example:
https://themeisle/blog/improve-internal-search-in-wordpress/
https://winningwp/best-wordpress-search-plugins/
I don't have a specific recommendation to offer as I'm just digging into this myself, hence having to link elsewhere.
Search functionality WordPress queries are slow by it's nature unfortunately, since it can use only SQL and it's not designed for full-text searches. The only working solution when your database becomes large enough is to use search engine software instead and call it from inside WordPress using some plugin.
One another free drop-in replacement we've made is https://wordpress/plugins/wow-fulltext-search/
LIKE
doing inORDER BY .. LIKE ..
? – kero Commented Sep 11, 2018 at 5:23