WooCommerce的问题太大数据库大小,尤其是post_meta
我有一个大约10K产品的WooCommerce网站,但有5.1 GIB数据库的大小,而POST_META仅占用4.5 GIB,但WP_POSTS表仅为350 MB。
我尝试了以下查询,但仍然没有帮助:
**Deleting orphaned Post Meta in WordPress**
SELECT * FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
OR
SELECT * FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID NOT IN (SELECT ID FROM wp_posts)
**Identify attachment metadata whose posts were deleted**
SELECT *
FROM wp_posts
WHERE
-- the attachments
post_type = 'attachment'
AND (
-- ignore anything without a parent
post_parent != 0
-- filter on anything that has a parent that does not exist
AND post_parent NOT IN (SELECT ID FROM wp_posts)
)
仍然没有帮助,请让我知道如何优化WP_POSTMETA表?
我有很多属性,因此此_Product_Attributes序列化数据对于每个产品来说都太大了。如果我们已经有条款和分类表,为什么他们需要在_product_attributes post_meta上再次保存。 :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
POST_META
(在WordPress或WooCommerce中)的索引效率低下。建议您添加此插件: wp index改进 < /a>更多讨论:
(从任何大表中删除未使用的数据很少有助于改善索引。)
post_meta
(in WordPress or WooCommerce) is inefficiently indexed. Suggest you add this plugin: WP Index ImprovementsMore discussion: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta
(Deleting unused data from any big table rarely helps as much as improving the indexes.)