当前位置:网站首页>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
原因,删除语句时要么不使
边栏推荐
- China micro cultivator market trend report, technical dynamic innovation and market forecast
- Type de Typescript
- How to select and build a real-time data warehouse scheme
- Pytorch uses multi GPU parallel training and its principle and precautions
- SQL server functions
- Lamda expression
- PyTorch混合精度原理及如何开启该方法
- Message queue - function, performance, operation and maintenance comparison
- Ppt template crawler case
- TCP連接與斷開,狀態遷移圖詳解
猜你喜欢

Import / export function implementation

如何设计好的技术方案

Thread status and stop
Installing rainbow in various kubernetes with Helm

Connexion et déconnexion TCP, détails du diagramme de migration de l'état

The interviewer with ByteDance threw me an interview question and said that if I could answer it, other companies would have an 80% chance of passing the technical level

MySQL-09

Thinking and summary of technical ability

PyTorch使用多GPU并行训练及其原理和注意事项

低代码实时数仓构建系统的设计与实践
随机推荐
Matching environment of ES6
跨域的五种解决方案
Gof23 - builder mode
TCP connection and disconnection, detailed explanation of state transition diagram
Library management system
Mongodb -- use mongodb to intercept the string content in the field and perform grouping statistics
Pychart cannot run designer Exe (this application failed to start because no Qt platform plugin could be I appears)
Experience the new features of Milvus 2.0 together
Pytorch uses multi GPU parallel training and its principle and precautions
Everything is a vector. The service practice of iqiyi online vector recall project
Message queue - function, performance, operation and maintenance comparison
SQL server functions
University Information Management System
获取当前月份的第一天和最后一天,上个月的第一天和最后一天
Logstash -- send an alert message to the nail using the throttle filter
Gof23 - abstract factory pattern
tf. nn. top_ k()
Comparison between Prometheus and ZABBIX
API and encapsulation of cookies
TS泛型在函数、接口、类中使用介绍