我有一個很長但很簡單的查詢,似乎要花費很長時間才能返回結果(超過2秒)。
下面是該查詢:簡單查詢需要很長時間才能執行
SELECT *
FROM `posts`
WHERE (`title` = 'Surprise Kanye West performance ends in fans\' disappointment'
AND `content` = '<p>It was an only-in-New-York moment: the announcement of a surprise Kanye West performance that drew throngs of people to the streets of Manhattan in the middle of the night. But instead of a concert to remember, the night ended with a hoard of disappointed fans and allegations that police used pepper spray to disperse them.<br/>Popular: <a href=\"http://podcast.cnn.com/anderson-cooper-360/episode/all/065F3vnWEzaATm/ac360-special-2016-01-07.html\" rel=\"noreferrer\" target=\"_blank\">Guns in America</a> | <a href=\"http://podcast.cnn.com/anderson-cooper-360/episode/all/09mJDnGHBvEtl7/6cgs1a.1-1.html\" rel=\"noreferrer\" target=\"_blank\">Sanders Demands Clinton Apologize</a> | <a href=\"http://podcast.cnn.com/fareed-zakaria-gps/episode/all/3m0KewVpkReuAh/gfaw6g.1-1.html\" rel=\"noreferrer\" target=\"_blank\">Blindsided: How ISIS Shook The World</a><br/></p>'
AND `poster` = '')
OR (`title` = 'Surprise Kanye West performance ends in fans\' disappointment'
AND `url` = 'http://www.cnn.com/2016/06/06/entertainment/kanye-west-surprise-concert-canceled/index.html'
AND `poster` = '')
OR `url` = 'http://www.cnn.com/2016/06/06/entertainment/kanye-west-surprise-concert-canceled/index.html' LIMIT 1;
下面是該表中的列:
http://i.imgur.com/w9qcpH2.png
我還沒有設置任何索引上的任一列是否有幫助。我該怎麼做才能使這個查詢運行得更快?
道歉,我編輯了我的帖子,以清楚地說明沒有索引已應用於任何列。 – user6461291
關於以'EXPLAIN'爲前綴的查詢,我已經試過了,但我不確定我能從給出的信息中得出什麼結論(供將來使用):http://i.imgur.com/TV5D0YN.png – user6461291
也,我是否也會在'(標題,網址,海報)'上添加複合索引? – user6461291