mysql多表(10个)怎么优化?

浏览:409 发布日期:2013/08/18 分类:求助交流
这个是DZX3的附件列表,这个SQL的表流程是,先获取板块ID,然后根据返回的帖子数来去DZ的十张附件表里,把所有的AID查询出来,我是这样写SQL语句的
select * from
(select * from pre_forum_attachment_0
union all
select * from pre_forum_attachment_1
union all
select * from pre_forum_attachment_2
union all
select * from pre_forum_attachment_3
union all
select * from pre_forum_attachment_4
union all
select * from pre_forum_attachment_5
union all
select * from pre_forum_attachment_6
union all
select * from pre_forum_attachment_7
union all
select * from pre_forum_attachment_8
union all
select * from pre_forum_attachment_9
) tb
where
aid in(select aid from pre_forum_attachment where tid IN (SELECT tid FROM `pre_forum_thread` WHERE ( fid='36' )))

我想请问怎么优化称THINKPHP支持的最快查询方式?
最佳答案
评论() 相关
后面还有条评论,点击查看>>