I have a simple table called 'million_words'. It has one row with two columns -> id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY & word VARCHAR(50 NOT NULL.
I run this query -: EXPLAIN SELECT * FROM million_words WHERE word = '-anon'
The Extra
column then prints : 'Impossible WHERE noticed after reading const tables
, even though the row is clearly present in the table.
Whats wronf
From MySQL documentation:
"Impossible WHERE noticed after reading const tables":
MySQL has read all const (and system) tables and notice that the WHERE clause is always false. Refer this
The table has at most one matching row, which is read at the start of the query. Because there is only one row, values from the column in this row can be regarded as constants by the rest of the optimizer. const tables are very fast because they are read only once.
const is used when you compare all parts of a PRIMARY KEY
or UNIQUE index
to constant values. Refer this
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