parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

unscheduled database resource usage via postmeta table query overconsumes database resources #122

Closed ewsopp closed 8 years ago

ewsopp commented 9 years ago

Our post_meta table has 570,508 rows and it appears Fantastic Elastic is having a hard time running this query:

SELECT meta_key FROM wp_12_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY meta_key

It creates too many active simultaneous connections to the database and simply overloads the available resources. This query was not trigger by a manual re-index, but appears to run on a regular basis - each time overloading our database server.

We were able to stop this from running by disabling the plugin, otherwise we would have to wait for it to complete while enduring downtime.

parisholley commented 9 years ago

I suspect it is because the admin page is initialized on the "init" action, when it should be on done only on "admin_init", and further more only when the settings page is loaded

timovanleeuwen commented 8 years ago

We're experiencing exactly the same, triggering resource overload on the server and downtime to the sites every once in a while.

Is there any solution for this?