Extra in EXPLAIN printing - 'Impossible WHERE noticed after reading const tables'

sanchitkhanna26 picture sanchitkhanna26 · Feb 19, 2013 · Viewed 11.3k times · Source

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

Answer

Bhavik Shah picture Bhavik Shah · Feb 19, 2013

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