MySQL的:不可能在读取const表后注意到 [英] Mysql: impossible where noticed after reading const tables
问题描述
我有一个查询:
SELECT l.id, title
FROM (SELECT id
FROM news
WHERE (title LIKE '%football predictions argentina%' OR text LIKE '%football predictions argentina%')
AND lang = 'en'
AND STATUS = 1
ORDER BY id LIMIT 0, 10)
o JOIN news l ON l.id = o.id
WHERE 1
ORDER BY date DESC
LIMIT 0, 10;
解释命令给我的
:在读取const表后注意到的地方不可能
which by the explain command is giving me: impossible where noticed after reading const tables
不幸的是,我无法弄清楚,这意味着什么以及如何解决?
unfortunately i cannot figure out, what that means and how to fix it ?
表的结构如下:
id int(10)
title varchar(255)
text text
image varchar(255)
lang varchar(3)
date date
status smallint(1)
除了id-主键外,我在(lang,status,date)上有一个组合索引
and except the id - Primary key i have one combined index on (lang, status, date)
推荐答案
在读取const表后不可能出现的地方"是令人困惑的消息.这基本上意味着您的条件之一与任何记录都不匹配,因此MySQL优化器无法(不想...)进一步分析查询.它只是简单地返回一个空结果集.
"impossible where noticed after reading const tables" is bit confusing message. It basically means that one of your where criteria did not match any records, therefore the MySQL optimiser could not (did not want to...) proceed with analysing the query further. It just simply returns an empty resultset.
修复非常简单:请确保使用返回结果集的where子句来测试解释.
Fix is very simple: make sure you test the explain with such where clauses that do return resultset.
MySQL有一个打开的功能请求,要求将消息更改为更多内容有意义,但我不认为他们曾经打扰过.
MySQL has an open feature request asking to change the message to a more meaningful one, but I do not think they ever have bothered.
这篇关于MySQL的:不可能在读取const表后注意到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!