Woocommerce 504关于具有六个属性的产品

时间:2018-08-17 12:07:58

标签: wordpress woocommerce

我希望有人能帮助我,我在woocommerce上安装了504个错误,当将具有六个属性的产品添加到购物车时。该产品设置了一个“ catchall”变体。我禁用了所有插件,并恢复为店面主题,仍然遇到相同的问题,它似乎与正在运行的非常慢的SQL查询直接相关。

查询似乎正在选择帖子ID,其中属性的元值与所选属性相匹配,在这种情况下,该属性是次优的,因为post_meta表中有70k条目,而帖子表中有数百个条目。该查询无法在合理的时间内完成,并且被多次调用,因此会终止SQL Server。我个人能够在mysql工作台中更快地重写查询,但我不知道它在哪里生成。查询如下:

SELECT   wp_posts.ID FROM wp_posts  LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  LEFT JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id AND mt1.meta_key = 'attribute_pa_workbee-size-drive' )  LEFT JOIN wp_postmeta AS mt2 ON ( wp_posts.ID = mt2.post_id )  LEFT JOIN wp_postmeta AS mt3 ON (wp_posts.ID = mt3.post_id AND mt3.meta_key = 'attribute_pa_extrusion-colour' )  LEFT JOIN wp_postmeta AS mt4 ON ( wp_posts.ID = mt4.post_id )  LEFT JOIN wp_postmeta AS mt5 ON (wp_posts.ID = mt5.post_id AND mt5.meta_key = 'attribute_pa_router' )  LEFT JOIN wp_postmeta AS mt6 ON ( wp_posts.ID = mt6.post_id )  LEFT JOIN wp_postmeta AS mt7 ON (wp_posts.ID = mt7.post_id AND mt7.meta_key = 'attribute_pa_dust-shoe' )  LEFT JOIN wp_postmeta AS mt8 ON ( wp_posts.ID = mt8.post_id )  LEFT JOIN wp_postmeta AS mt9 ON (wp_posts.ID = mt9.post_id AND mt9.meta_key = 'attribute_pa_cam-software' )  LEFT JOIN wp_postmeta AS mt10 ON ( wp_posts.ID = mt10.post_id )  LEFT JOIN wp_postmeta AS mt11 ON (wp_posts.ID = mt11.post_id AND mt11.meta_key = 'attribute_pa_connectivity' ) WHERE 1=1  AND wp_posts.post_parent = 2603  AND ( 
 ( 
   ( wp_postmeta.meta_key = 'attribute_pa_workbee-size-drive' AND wp_postmeta.meta_value IN ('','') ) 
   OR 
   mt1.post_id IS NULL
 ) 
 AND 
 ( 
   ( mt2.meta_key = 'attribute_pa_extrusion-colour' AND mt2.meta_value IN ('','') ) 
   OR 
   mt3.post_id IS NULL
 ) 
 AND 
 ( 
   ( mt4.meta_key = 'attribute_pa_router' AND mt4.meta_value IN ('','') ) 
   OR 
   mt5.post_id IS NULL
 ) 
 AND 
 ( 
   ( mt6.meta_key = 'attribute_pa_dust-shoe' AND mt6.meta_value IN ('','') ) 
   OR 
   mt7.post_id IS NULL
 ) 
 AND 
 ( 
   ( mt8.meta_key = 'attribute_pa_cam-software' AND mt8.meta_value IN ('','') ) 
   OR 
   mt9.post_id IS NULL
 ) 
 AND 
 ( 
   ( mt10.meta_key = 'attribute_pa_connectivity' AND mt10.meta_value IN ('','') ) 
   OR 
   mt11.post_id IS NULL
 )
) AND wp_posts.post_type = 'product_variation' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order ASC LIMIT 0, 1

0 个答案:

没有答案