Title: Performance problems &#8211; abundant writes
Last modified: May 1, 2018

---

# Performance problems – abundant writes

 *  Resolved [Pablo Westphalen](https://wordpress.org/support/users/pablowestphalen/)
 * (@pablowestphalen)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/)
 * Is this plugin coded for scalability?
 * It’s the single biggest bottleneck of our site when traffic increases.
 * Writes to its tables are abundant, and run on every cart interaction and on every
   page load through the calculate_totals() hook.
 * Do you have tips for optimizing the database for it?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [chetnapatel](https://wordpress.org/support/users/chetnapatel/)
 * (@chetnapatel)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10239219)
 * Hi,
 * Thank you for posting your query on our plugin’s page.
 * We do not user calculate_totals() hook in our plugin. Could you please share 
   with us URL of your website?
 * Can you please let me know you face a performance related issue while our plugin
   is activated?
 * Regards,
    Chetna Bhutka
 *  Thread Starter [Pablo Westphalen](https://wordpress.org/support/users/pablowestphalen/)
 * (@pablowestphalen)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10245438)
 * Hi! You’re right, i mentioned the wrong hook. I’m analyzing this plugin’s performance
   impact and came across these 3 major findings
 * 1 – wcal_activate() does not set indexes on the tables it creates for the most
   queried columns, so the SELECT queries are slow when the tables get big. I’ve
   manually added some and that helped lookup performance.
 * 2 – The wcal_store_cart_timestamp() function from woocommerce-ac.php is hooked
   to woocommerce_cart_updated and that indeed fires on every page load. This is
   a function that does writes to the database and i would think (correct me if 
   im wrong) that we only want it to run when something about the cart **actually**
   changes.
 * 3 – the save_data() method from wcal_class-guest.php has DB write calls inside
   a foreach loop. my profiling tool (new relic) captured one request to it that
   ran 66 “DELETE FROM `_ac_abandoned_cart_history_lite` WHERE user_id = ?” queries
   that took a total of 56,900ms to process (i think that table indexes would have
   helped then but, still, there’s got to be a way to optimize these queries, using
   foreach loop to build one big query that’ll run only once.
 * Oh and i’m afraid i can’t share the URL, it’s not a public store.
 *  Thread Starter [Pablo Westphalen](https://wordpress.org/support/users/pablowestphalen/)
 * (@pablowestphalen)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10245806)
 * Actually, i was not that wrong in the beggining. The plugin doesn’t directly 
   hook itself to calculate_totals(), but it seems that woocommerce_cart_updated
   is a dangerous hook ([https://github.com/woocommerce/woocommerce/issues/13542](https://github.com/woocommerce/woocommerce/issues/13542))
   that ends up being triggered by it [and other things], so wcal_store_cart_timestamp
   is called as a side effect (on every kind of request, even to admin heartbeats)
    -  This reply was modified 8 years, 1 month ago by [Pablo Westphalen](https://wordpress.org/support/users/pablowestphalen/).
 *  Plugin Contributor [chetnapatel](https://wordpress.org/support/users/chetnapatel/)
 * (@chetnapatel)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10257569)
 * Hi,
 * Thank you for analyzing our plugin’s performance impact and explaining about 
   your findings.
 * I will be looking into the issue and get back to you with an update. Could you
   please drop us an email on “support at tychesoftwares dot freshdesk dot com” 
   where I can provide you the plugin file and we can more communicate on it?
 * Regards,
    Chetna Bhutka
 *  [joe.fedric.tl](https://wordpress.org/support/users/joefedrictl/)
 * (@joefedrictl)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10530643)
 * I am having this problem, also, but I see that the thread is marked as *solved*.
   Is this problem back in Abandoned Cart Lite v4.9? I’m seeing heavy transaction
   times on wcal_store_cart_timestamp(), around 77000ms in some cases. I am also
   going to submit a support request for wider exposure. Thanks!
    -  This reply was modified 7 years, 10 months ago by [joe.fedric.tl](https://wordpress.org/support/users/joefedrictl/).
 *  Plugin Contributor [chetnapatel](https://wordpress.org/support/users/chetnapatel/)
 * (@chetnapatel)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10840081)
 * Hi [@pablowestphalen](https://wordpress.org/support/users/pablowestphalen/) &
   [@joefedrictl](https://wordpress.org/support/users/joefedrictl/),
 * Yesterday, we have released our plugin version 5.1.0. From this version, we have
   optimized the code of the plugin so as to make sure it occupies less resources.
   You can read changelog [here](https://wordpress.org/plugins/woocommerce-abandoned-cart/#developers).
 * Can you please update the plugin and confirm that the loading issue has been 
   fixed or not?
 * Let me know if you have any queries with this.
 * Regards,
    Chetna Bhutka

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Performance problems – abundant writes’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-abandoned-cart/assets/icon-256x256.png?rev=2369396)
 * [Abandoned Cart Lite for WooCommerce](https://wordpress.org/plugins/woocommerce-abandoned-cart/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-abandoned-cart/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-abandoned-cart/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-abandoned-cart/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-abandoned-cart/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-abandoned-cart/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [chetnapatel](https://wordpress.org/support/users/chetnapatel/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/performance-problems-abundant-writes/#post-10840081)
 * Status: resolved