当前位置:网站首页>MySQL delete in without index

MySQL delete in without index

2022-06-26 06:33:00 Oriental phantom

Sentence format :

 explain delete  from enrollee where enrollee_id in (select uid from dup_super_id where delete_ind=1);
There are not many subqueries , The external table is a large table . Initially, the execution plan is a full table scan .

analyze table Or subqueries are indexed , The attributes of the associated fields of the internal and external tables are also consistent , Just don't go to the index .

Thought of the writing method . use inner join try :

explain delete a from enrollee a inner join dup_super_id b where a.enrollee_id=b.uid and b.delete_ind=1;

 

Why? delete no way ?

1. Thought of a previous error report :

“SQL Delete statement add table alias :DELETE FROM table_name t WHERE t.id=1; Wrong report .

Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't where t.id=1' at line 1

reason , When deleting a statement, either do not

原网站

版权声明
本文为[Oriental phantom]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260618535749.html