一个在mysql中查询过慢的问题,我的查询语句是多表联合查询.语句写法如下.感觉不是很好.能否优化?
selecta1.startdate,concat(hour(a1.starttime),':00:00')asstarttime,a1.Sector1,a1.AAAAA...
select a1.startdate, concat(hour(a1.starttime),':00:00') as starttime, a1.Sector1,
a1.AAAAA as `SDCCH信道切换掉话次数`,a2.BBBBB as `二级干扰频带内的空闲信道平均数`,a3.CCCCC as `上行LLC流量`,a4.DDDDD as `NB_PSI_MES`,a5.EEEEE as `最坏小区个数`,a6.FFFFF as `下行报务率`
from
(select startdate, concat(hour(starttime),':00:00') as starttime, concat(BSC,'_',CELL_NAME,'_',BTS_INDEX,'_',BTS_SECTOR)as Sector1,
count(distinct(starttime))*90000 as CountDuration,sum(rt1.`AAAAA`) as AAAAA
from omdb.rt110celltrxrelatedoverviewcounters1 rt1
where startdate >= '2011-06-21' and startdate <= '2011-06-21' and starttime >= '08:00:00' and starttime < '09:00:00'
group by startdate, hour(starttime), BSC,CELL_NAME,BTS_INDEX,BTS_SECTOR)
a1
left join
a2.....left join......a3.....left join ......a4.....left join......a5........left join ....... a6
a2,a3,a4,a5,a6....类型同a1.....
每个表中不只一个字段,相当的多.主表中是选择了a1...a6的字段建立中文字段.在这我只写了6个,其实起码200多个字段. 展开
a1.AAAAA as `SDCCH信道切换掉话次数`,a2.BBBBB as `二级干扰频带内的空闲信道平均数`,a3.CCCCC as `上行LLC流量`,a4.DDDDD as `NB_PSI_MES`,a5.EEEEE as `最坏小区个数`,a6.FFFFF as `下行报务率`
from
(select startdate, concat(hour(starttime),':00:00') as starttime, concat(BSC,'_',CELL_NAME,'_',BTS_INDEX,'_',BTS_SECTOR)as Sector1,
count(distinct(starttime))*90000 as CountDuration,sum(rt1.`AAAAA`) as AAAAA
from omdb.rt110celltrxrelatedoverviewcounters1 rt1
where startdate >= '2011-06-21' and startdate <= '2011-06-21' and starttime >= '08:00:00' and starttime < '09:00:00'
group by startdate, hour(starttime), BSC,CELL_NAME,BTS_INDEX,BTS_SECTOR)
a1
left join
a2.....left join......a3.....left join ......a4.....left join......a5........left join ....... a6
a2,a3,a4,a5,a6....类型同a1.....
每个表中不只一个字段,相当的多.主表中是选择了a1...a6的字段建立中文字段.在这我只写了6个,其实起码200多个字段. 展开
展开全部
没有看到你的语句~~~~~~~~~~~~
首先多表联合查询 效率本来就地下~~~~~~~~
首先多表联合查询 效率本来就地下~~~~~~~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
语句呢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询