当前位置:网站首页>Mysql delete in 不走索引的
Mysql delete in 不走索引的
2022-06-26 06:19:00 【东方-phantom】
语句格式:
explain delete from enrollee where enrollee_id in (select uid from dup_super_id where delete_ind=1);
子查询没多少条,外部的表是大表。初步看执行计划是全表扫描。

analyze table 或者子查询都加了索引,内外表的关联字段属性也都一致,就是不走索引。
想到了写法。用inner join试试:
explain delete a from enrollee a inner join dup_super_id b where a.enrollee_id=b.uid and b.delete_ind=1;
为什么delete不行?
1.想到了以前的一个报错:
“SQL删除语句添加表别名:DELETE FROM table_name t WHERE t.id=1;报错了。
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
原因,删除语句时要么不使
边栏推荐
- Logstash - logstash sends an alarm email to email
- Underlying principle of MySQL index
- 去哪儿网BI平台建设演进史
- EFK升级到ClickHouse的日志存储实战
- Import / export function implementation
- Library management system
- Mysql-10 (key)
- 视图简析
- Message queue - message transaction management comparison
- Mongodb -- use mongodb to intercept the string content in the field and perform grouping statistics
猜你喜欢
随机推荐
Library management system
3.pyinstaller模块介绍
[spark] how to implement spark SQL field blood relationship
Implement the runnable interface
打印数字的位信息
【golang】time相关
Unsatisfied dependency expressed through field ‘baseMapper‘; nested exceptio
低代码实时数仓构建系统的设计与实践
Logstash -- send an alert message to the nail using the throttle filter
Market trend report, technical innovation and market forecast of microencapsulated chemical pesticides in China
连接数服务器数据库报:错误号码2003Can‘t connect to MySQL server on ‘服务器地址‘(10061)
数据可视化实战:实验报告
Zotero文献管理工具之Jasminum(茉莉花)插件
MySQL-09
Redis multithreading and ACL
技术Leader的思考技巧
GoF23—抽象工厂模式
事务与消息语义
架构设计方法
Keepalived to achieve high service availability









