2

Couple of days ago I was checking the size of my database and I was amazed on how huge it is. The most weird thing for me is that my site is not using comments, and still the wp_comment table is more 27MB. When I took a look inside I saw this for example - a comment from Woocommerce saying this in the content - Order status changed from Pending Payment to Proce... or this IPN payment completed.

Now I use many plugins on the site, but I`m still not sure why orders status should be in wp_comments. Also in the backend of WordPress, there are zero comments in spam, approved or trash...

What shall I do? Shall I remove all comments there? I thought Wordpress is writing in the orders tables for this purposes...

  • Reviews and Order Notes are stored as comments. WooCommerce automatically creates order notes for things like status changes. – Jacob Peattie Jan 29 '18 at 14:09
1

That is just the way WordPress "forces" plugins like WooCommerce to work. But some people frustrated with the performance impact of this have developed this plugin to make WooCommerce use custom tables, properly indexed. Give it a go in a test environment first.

|improve this answer|||||
  • WordPress doesn't 'force' WooCommerce to do anything. WooCommerce could've used custom tables, or move to custom tables, if they wanted. They've just opted not to for whatever reason. It's not WordPress' fault. – Jacob Peattie Jan 29 '18 at 15:35
  • You are right that it is not WordPress' fault that the things are like that, although it is about time for a change :) – Vlad Olaru Jan 29 '18 at 19:28
  • WooCommerce is thankfully moving towards custom tables for a lot of its functionality (starting by abstracting away the specific storage method), but as long as orders are stored in wp_posts then wp_comments is probably the appropriate place. – Jacob Peattie Jan 30 '18 at 6:31
0

Oh, that is double offtopic, but for the sake of helping other people which might wonder the same about EDD and maybe other plugins, the reason is because wordpress core to not have any easy support for hierarchy between CPTs except for comments being under posts. As orders are "belonging" to specific products it makes a simple hack to emulate such a relationship by using comments.

Why not just store order in separate table? because on wordpress.com which is one of the biggest wordpress hosters in the world plugins are not allowed to create new table, therefor WC and EDD had to come up with some hack.

What should you do? probably nothing, why do you even look at the DB in the first place? Checking out the architecture of code is something you should do before putting it on production. After it was running for a while it becomes too late to think about alternatives.

|improve this answer|||||
  • Looked into the database cause its getting huge. Sorry I did :) Thanks for the answer anyway – figment Jan 29 '18 at 14:33
  • @figment, sometimes it is just better not to know :) helps you sleep better :) – Mark Kaplun Jan 29 '18 at 14:40
  • The danger of just leaving your database alone to get huge is eventually you'll run into performance issues. Checking on it periodically and finding ways to optimize it is smart, you just need to be cautious and take backups as you try different things. :) – WebElaine Jan 29 '18 at 15:01
  • @WebElaine the only thing you can optimize is your own code, which is why I stay away from things like ACF, but once you have bought into a plugin you are unlikely to be able to change how it behaves and keep updating it to new versions. – Mark Kaplun Jan 29 '18 at 17:18
  • Depends largely on the plugin. There's an upcoming plugin for ACF that moves the data into separate tables - if you largely use plugins that are focused enough on the community to allow collaboration or at least extension, you can often do some things to improve performance. – WebElaine Jan 29 '18 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.