修改外键和执行计划分析
EXPLAIN SELECT
te.*, tl.*
FROM
t_employee te
LEFT JOIN t_employee_log tl ON te.EMPLOYEE_ID = tl.EMPLOYEE_ID;
alter table t_employee_log add foreign key (EMPLOYEE_ID) references t_employee(EMPLOYEE_ID);
生成的默认索引:t_employee_log_ibfk_1
select COUNT(1) from t_employee;
select COUNT(1) from t_employee_log ;
show INDEX from t_employee;
show INDEX from t_employee_log;
SELECT
tel.EMPLOYEE_ID
FROM
t_employee_log tel
where tel.EMPLOYEE_ID not in(
select te.EMPLOYEE_ID
from t_employee te);
DELETE from t_employee_log
WHERE
EMPLOYEE_ID IN (
"3db901474f844d84be54802cec20a9e3",
"f8e042c8678148a796d69bde1e6ec133"
);
抱怨没有用,只能靠自己
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步