Search code examples
mysqlexplain

There is no possible_keys available, but there exists keys in the where clause


 CREATE TABLE `words_data` (
  `id` int(11) NOT NULL auto_increment,
  `words` varchar(50) default '',
  `pid` int(8) default '0',
  `baiyephp` int(11) default '0',
  PRIMARY KEY  (`id`),
  KEY `baiyephp` (`baiyephp`),
  KEY `words` (`words`),
  KEY `pid` (`pid`),
  KEY `pid_id` (`id`,`pid`)
 ) ENGINE=MyISAM AUTO_INCREMENT=1961736 DEFAULT CHARSET=utf8

Explain statement: explain select id from words_data where pid=232632; but no possible_keys and no keys listed in the columns.


Solution

  • Explain yields in my test environment:

    Impossible WHERE noticed after reading const tables
    

    Which seems to indicate that there are no data in the table with pid=232632