1
我有一个以下的mysql查询,它由一些内部选择操作组成。但它是缓慢摆脱该查询输出..Mysql内部选择优化
SELECT
c.topicName as 'topicName',
c1 as 'sumOfWordsInTopic',
c.word,
c.wordCount,
c2/c1 AS 'wordProbability'
FROM weightallofwordsintopic as c
JOIN (
SELECT topicName, sum(wordCount) AS 'c1'
FROM weightallofwordsintopic group by topicName
) AS sub1 ON c.topicName = sub1.topicName
JOIN (
SELECT topicName,word, wordCount AS 'c2'
FROM weightallofwordsintopic
) AS sub2 ON c.topicName = sub2.topicName and c.word=sub2.word
一是内部的选择需要wordCounts的总和与第二个需要wordcounts和他们的外部选择采取分工。有什么办法让它更快一点?感谢您的关注..
非常感谢您的关注。 – mstfky