当前位置:网站首页>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
原因,删除语句时要么不使
边栏推荐
- Efk upgrade to Clickhouse log storage practice
- Customer Stories | Netease spring breeze: the "spring breeze" of the fun industry, reaching out to all areas through in-depth interaction
- SQL server functions
- Playing RTSP streaming video on Web pages (webrtc)
- Tencent WXG internship experience (has offered), I hope it will help you!
- MySQL 索引底层原理
- MySQL-05
- Introduction to canal deployment, principle and use
- Market trend report, technical innovation and market forecast of microencapsulated chemical pesticides in China
- How to design a good technical scheme
猜你喜欢

canal部署、原理和使用介绍

事务与消息语义

Transformer中的Self-Attention以及Multi-Head Self-Attention(MSA)

Library management system

Go语言学习笔记 1.1

实时数仓方案如何选型和构建

Logstash -- send an alert message to the nail using the throttle filter

Use the fast proxy to build your own proxy pool (mom doesn't have to worry about IP being blocked anymore)

How to design a good technical scheme

技术能力的思考和总结
随机推荐
Thread status and stop
Everything is a vector. The service practice of iqiyi online vector recall project
Print bit information of numbers
DPDK——TCP/UDP协议栈服务端实现(二)
SQL Server view
Work accumulation - problems encountered in using ThreadLocal in web requests
vs code 使用 prettier 格式化 js 的时候, 函数定义的名称和括号之间有一个空格, 而 eslit 又不允许这个空格.
MySQL-08
Logstash——Logstash将数据推送至Redis
How to design a good technical scheme
Install pyinstaller
SparseArray
Efk upgrade to Clickhouse log storage practice
View analysis
Efk Upgrade to clickhouse log Storage Reality
Logstash——Logstash向Email发送告警邮件
Go学习笔记1.3-变量的数据类型篇
Unsatisfied dependency expressed through field ‘baseMapper‘; nested exceptio
Pychart cannot run designer Exe (this application failed to start because no Qt platform plugin could be I appears)
Ppt template crawler case