日期:2014-05-16  浏览次数:20765 次

查询速度慢,望高手解决
表结构
c_tag_word 表(id,word)
c_movie_tag_director (aid,tagid)

SQL code

select word from c_tag_word 
where exists( 
select 1 from c_movie_tag_director where aid= '1209' and tagid=c_tag_word.id 
)


类似这样的语句,一个php页面中要执行 100次,执行每一句 我这边用时0.2秒,打开一个PHP页面 执行100次,光这个mysql查询就要20秒的时候,这个有什么方法可以解决?

------解决方案--------------------
SQL code
select distinct a.word
from c_tag_word a,c_movie_tag_director b
where a.id=b.tagid and b.aid= '1209'