简体   繁体   English

Wordpress 非常慢的查询

[英]Wordpress Very Slow Query

I have this query我有这个查询

SELECT DISTINCT t.*
              , tt.* 
           FROM wp_terms t  
           JOIN wp_termmeta 
             ON t.term_id = wp_termmeta.term_id 
           JOIN wp_termmeta mt1 
             ON t.term_id = mt1.term_id 
           JOIN wp_termmeta mt2 
             ON t.term_id = mt2.term_id 
           JOIN wp_term_taxonomy tt 
             ON t.term_id = tt.term_id 
          WHERE tt.taxonomy IN ('episodes') 
            AND wp_termmeta.meta_key = 'episode_number'  
            AND mt1.meta_key = 'tr_id_post' 
            AND mt1.meta_value = '7547' 
            AND mt2.meta_key = 'season_number' 
            AND mt2.meta_value = '2' 
          ORDER 
             BY wp_termmeta.meta_value+0 ASC;

I don't know how to make it faster, it takes like 1.2 sec to execute, my website loads very hard because of it.我不知道如何让它更快,执行需要 1.2 秒,因此我的网站加载非常困难。

How big is the table?桌子有多大? Check to see if a plugin is flooding that table with junk that it fails to clear out.检查插件是否在该表中充斥着无法清除的垃圾。

The "meta" tables have an inefficient schema. “元”表的架构效率低下。 This explains what to do to improve the performance of them: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta这解释了如何提高它们的性能: http : //mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM