i have one query:
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;
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 ?
the structure of the table is like this:
id int(10)
title varchar(255)
text text
image varchar(255)
lang varchar(3)
date date
status smallint(1)
and except the id - Primary key i have one combined index on (lang, status, date)
"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.
Fix is very simple: make sure you test the explain with such where clauses that do return resultset.
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.
In addition to Shadow's answer, MySQL's explain will show: Impossible WHERE noticed after reading const tables
when a where condition on a non-indexed field is not matched along with a matched where condition on an indexed field.
It will show no matching row in const table
when a where condition on an indexed field is not matched.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With