The WP_Options table in the MySQL database is larger than 360Mb - can I reduce the size by removing WC_sessions?

I have a Wordpress / woocommerce store and am trying to clean things up a bit as it is very sluggish on the backend.

While investigating, I found that only my wp_options table is over 360MB in size (I don't know what is normal, but it seems large). While doing random spot checks, it seems to be almost completely filled with woocommerce sessions: _wc_session_119a59e205553cc7d91bbf19b0b64768 and wc_max_related, which have no expiration date.

  • I used woocommerce-> system status-> tools to remove all expired wc transients
  • I installed the Transients Manager plugin and removed all expired transients, but only removed 300 entries. It still reports 7,300 transients ( http://i.stack.imgur.com/GXmNw.jpg )

It looks like I've only had about 30 clients in the last 2 or 3 days and I'm concerned that this is slowing down my admin panel. Is it safe to delete all wc_sessions when there is no one on the site? If so, will I do it by doing "clear all sessions" in woocommerce-> system status-> tools? I don't want to delete customer orders or anything, but my understanding is that these are just open carts, etc.

+3


source to share


2 answers


You haven't specified which version of WooCommerce you are using, but there are usually two reasons why there are more client sessions than expected:

  • CRON tasks not working
  • Bots that visit the site and create multiple sessions.


The client session is kept in WooCommerce for 48 hours.

This stackoverflow question has posted protections for your situation: woocommerce generates more sessions than users

+2


source


UPDATE: With WooCommerce 2.5 woocommerce - large sessions have been merged into the core.

CRON tasks work for some of my clients and we have blocked bots from add-to-cart site. wc_sessions are still out of control. I found this plugin that was created because storing wc_sessions in the wp_options table caused options caching issues.

This plugin moves wc_sessions from wp_options and into it its own table and performs its own cleanup hourly. *



Plugin: https://github.com/kloon/woocommerce-large-sessions

  • I've just started using this, so I'll come back to confirm it works.
+1


source







All Articles