“Impossible WHERE noticed after reading const tables”

While I was finally done with the algorithm, I did a testing and all was fine. But still, mind was not happy for I need to save 10+seconds to make a proud body language.. So i decided to see how the optimizer reviews the computational queries in the algorithm and also it would help with interim datas and whether effects are as desired…

Ooops, I got this on a EXPLAIN and felt confused to see ‘Extra’ column hold “Impossible WHERE noticed after reading const tables”. What could be the reason, and started a bit of googling. Somewhere , I saw one mentioning that it could be bcoz the WHERE might be having column with UNIQUE and INDEX on a single column. Was that the truth? No.

Indus got me a good pointer and it helped me assured. EXPLAIN works with taking WHERE part of the query and obviously varies from datasets to datasets. It also means, empty table would get this title in extra 😉 for the table is empty.

A good link I used is: http://www.faqts.com/knowledge_base/view.phtml/aid/945

Advertisements

One Response to ““Impossible WHERE noticed after reading const tables””

  1. I got this same message on a query I used that replaced an ORDER BY RAND(NOW)) query. the query works, but I get this message when I use explain with it. From what I read, this query (and sub-query) is faster than the RAND query, and supposedly, more random.

    The original query was:

    EXPLAIN SELECT quote,name
    FROM quote
    ORDER BY RAND(NOW())
    LIMIT 1

    And the replacement query is:

    EXPLAIN SELECT quote,name
    FROM quote
    WHERE quoteid = ROUND(“.lcg_value().” * (SELECT COUNT(*) FROM quote))
    LIMIT 1

    There are 1912 rows in the table. Any idea what I am doing wrong?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: