Title: Slow query on sites with large wp_options table
Last modified: October 20, 2025

---

# Slow query on sites with large wp_options table

 *  [jesperh95](https://wordpress.org/support/users/jesperh95/)
 * (@jesperh95)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/slow-query-on-sites-with-large-wp_options-table/)
 * Hi,
   This plugins creates a “slow query” (found with Query Monitor) in the back-
   end on every page load on sites with large wp-options tables. It happens because
   of this query:
 * _“SELECT option\_value
   FROM wp\_optionsWHERE option\_name LIKE ‘wc\_facebook\
   _background\_product\_sync\_job\_%’AND ( option\_value LIKE ‘%\”status\”:\”processing\”%’)
   ORDER BY option\_id desc”The query is located here: “/includes/Framework/Utilities/
   BackgroundJobHandler.php”, around line 531 (in plugin version 3.5.11)It is a 
   related issue to this following support topic from another user, which did not
   get a response to his last question: [https://wordpress.org/support/topic/facebook-for-woocommerce-plugin-causing-many-slow-queries-degrading-performance/](https://wordpress.org/support/topic/facebook-for-woocommerce-plugin-causing-many-slow-queries-degrading-performance/)
 * It seems the only way to fix this issue would to be to rewrite the “background-
   job-handler”, to not use “wp-options”-table and not use “LIKE” in the SQL-query,
   which creates full table scans. Because this causes a slow query and degregated
   performance on larger sites with larger “wp_options” tables.

Viewing 1 replies (of 1 total)

 *  Thread Starter [jesperh95](https://wordpress.org/support/users/jesperh95/)
 * (@jesperh95)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/slow-query-on-sites-with-large-wp_options-table/#post-18692986)
 * Hi again,
   My side btw have 70.000+ entries in wp_options containing “wc_facebook_background_product_sync_job”,
   and they are all completed. So another “quick-fix” solution would be to remove
   these, so that above query would be much faster. But do you know why these entries
   stay in wp_options? I think they should be deleted right after the job has been
   completed? Besides, it seems there is some kind of clean-up happening, since 
   the earliest entries are approx 100 days old, and it keeps staying like this.
   So if this is correct, then another solution could be to set this clean-up window
   to maybe 7 days instead. Do you know if this is possible?

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fslow-query-on-sites-with-large-wp_options-table%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/facebook-for-woocommerce/assets/icon.svg?rev=3469606)
 * [Meta for WooCommerce](https://wordpress.org/plugins/facebook-for-woocommerce/)
 * [Support Threads](https://wordpress.org/support/plugin/facebook-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/facebook-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/facebook-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/facebook-for-woocommerce/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [jesperh95](https://wordpress.org/support/users/jesperh95/)
 * Last activity: [5 months, 2 weeks ago](https://wordpress.org/support/topic/slow-query-on-sites-with-large-wp_options-table/#post-18692986)
 * Status: not resolved