繁体   English   中英

有人可以帮我吗? [关闭]

[英]can someone help me on this? [closed]

我想优化下面的查询,目前,它用于全表扫描。 NOT IN 运算符是否有可能重写?

DELETE 
FROM `r_so` 
WHERE `created_on` < '2022-03-09 00:00:00' 
AND `so_id` NOT IN (select distinct so_id 
                           from r_rating
                    ) LIMIT 1000 
*************************** 1. row ***************************
           id: 1
  select_type: DELETE
        table: review_so
   partitions: NULL
         type: range
possible_keys: created_on_idx
          key: created_on_idx
      key_len: 5
          ref: const
         rows: 132979575
     filtered: 100.00
        Extra: Using where

*************************** 2. row ***************************
           id: 2
  select_type: DEPENDENT SUBQUERY
        table: rev_rating
   partitions: NULL
         type: unique_subquery
possible_keys: UK_r_rating_so_id
          key: UK_r_rating_so_id
      key_len: 36
          ref: func
         rows: 1
     filtered: 100.00
        Extra: Using index

有没有可能重写这个查询?

暂无
暂无

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

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