查询卡在Mariadb 10.1中

时间:2019-11-20 09:37:45

标签: mysql mariadb

当我在mariadb 10.1中执行此查询时(在帖子#末尾写#)。它占用了100%的CPU使用率,并且没有显示任何输出。

当我在mysql 5.7中运行此查询时。它给了我错误

  

“错误1055(42000):ORDER BY子句的表达式#1不在GROUP中   BY子句,包含非聚合列   'DB.istockstatus.meta_value'在功能上不依赖于   GROUP BY子句中的列;这与   sql_mode = only_full_group_by“

所以我在查询中更改了SQL模式

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

然后在mysql 5.7中工作。

但是它在mariadb 10.1中不起作用。 任何人都面临这个问题。请帮忙。

写在帖子末尾

| 19937 | uRw1oPvHmYiKb7 | localhost | uRw1oPvHmYiKb7 | Query   | 52086 | 

Sending data | 
SELECT   WP_posts.ID FROM WP_posts  
LEFT JOIN WP_term_relationships tr ON WP_posts.ID = tr.object_id 
LEFT JOIN WP_term_taxonomy tt ON tt.term_taxonomy_id=tr.term_taxonomy_id 
LEFT JOIN WP_terms tm ON tm.term_id = tt.term_id 
LEFT JOIN WP_term_relationships tr_v ON WP_posts.ID = tr_v.object_id 
LEFT JOIN WP_term_taxonomy tt_v ON ( tt_v.term_taxonomy_id=tr_v.term_taxonomy_id AND tt_v.taxonomy LIKE 'product_visibility' 
AND tt_v.term_taxonomy_id NOT IN ( 7 ) ) 
LEFT JOIN WP_terms tm_v ON tm_v.term_id = tt_v.term_id 
INNER JOIN WP_postmeta istockstatus ON (WP_posts.ID = istockstatus.post_id)  
WHERE 1=1  AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> ''  AND (
      WP_posts.ID NOT IN (
                                    SELECT object_id
                                    FROM WP_term_relationships
                                    WHERE term_taxonomy_id IN (7)
                            )
    ) 
AND WP_posts.post_type = 'product' 
AND ((WP_posts.post_status = 'publish')) 
AND (  ( LOWER( WP_posts.post_title ) REGEXP  '6?(.*)x?(.*)6?(.*)sq')  
OR ( LOWER(WP_posts.post_excerpt) REGEXP '6?(.*)x?(.*)6?(.*)sq')  
OR ( LOWER(WP_posts.post_content) REGEXP '6?(.*)x?(.*)6?(.*)sq')   
OR  (( LOWER(tm.name) REGEXP '6?(.*)x?(.*)6?(.*)sq' OR LOWER(tm.slug) REGEXP '6?(.*)x?(.*)6?(.*)sq') 
AND tt.taxonomy IN ('product_tag'))  )  
GROUP BY WP_posts.ID 
ORDER BY  istockstatus.meta_value ASC, 
(CASE WHEN WP_posts.post_title LIKE '6 x 6 sq%' THEN 1 WHEN WP_posts.post_title LIKE '%6 x 6 sq%' THEN 2 WHEN WP_posts.post_title LIKE '%6%' 
AND WP_posts.post_title LIKE '%6%' AND WP_posts.post_title LIKE '%sq%' THEN 3 
WHEN WP_posts.post_title LIKE '%6%' 
OR WP_posts.post_title LIKE '%6%' 
OR WP_posts.post_title LIKE '%sq%' 
THEN 4 WHEN LOWER(tm.name) LIKE '6 x 6 sq' 
THEN 5 WHEN LOWER(tm.name) LIKE '%6 x 6 sq%' 
THEN 6 WHEN WP_posts.post_content LIKE '%6 x 6 sq%' 
THEN 7 ELSE 8 END) LIMIT 0, 6 |    0.000 |

0 个答案:

没有答案