MySQL thinks subquery is derived when it is not!(MySQL认为子查询不是派生的!)
问题描述
EXPLAIN SELECT node_id
FROM node
WHERE person_id IN (SELECT person_id
FROM user
WHERE is_locked = 0);
MySql 中的结果告诉我子查询是派生的.但事实并非如此!
Results in MySql telling me the subquery is derived. But it's not!
(我知道这很容易被重写为 JOIN,但我想知道为什么 MySQL 认为这是一个依赖子查询.)
(I know this could easily be re-written as a JOIN, but I want to know why MySQL thinks this is a dependent subquery.)
推荐答案
这是 MySQL 查询优化器中的一个错误.看起来,如果子查询中的表与主查询中的表匹配,即使它显然不应该是,它也被视为依赖子查询,并且没有简单的修复.对不起;去参加吧.
This is a bug in the MySQL Query Optimizer. It would seem that, if the table in the subquery matches the table in the main query, it is considered a dependent subquery even if it obviously should not be, and there's no easy fix. Sorry; go for the join.
这篇关于MySQL认为子查询不是派生的!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL认为子查询不是派生的!


- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- SQL 临时表问题 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01