(oracle SQL)对二千万条数据的表进行统计得出报表 ( 积分: 100 )

  • 主题发起人 主题发起人 苏记豆浆
  • 开始时间 开始时间

苏记豆浆

Unregistered / Unconfirmed
GUEST, unregistred user!
对二千万条数据的表进行统计得出报表,此大表还和外面三个表有关联,统计起来,一条语句用1分钟多点的时间.
如何让速度变快呢
 
select sg.sgname as tsgname,
t.suid as tsuid,
sg.sgid as sgsgid,
t.systemtime as tsystemtime,
to_char(ceil((ceil(t.speed * 0.036) /to_number(substr(t.ostdesc,instr(t.ostdesc, '阈') + 3,3)) - 1) * 100)) as tt
from mcc_track t,
serviceunit sc,
servicegroup sg,
vehicle v,
mobile m
where t.utc >= 1175385600
and t.utc < 1177891200
and m.mtype = 12
and t.ostdesc like '%超速报警%'
and t.ostdesc like '%定位有效%'
and t.ostdesc like '%定时间隔%'
and t.suid = sc.suid
and sc.sgid = sg.sgid
and sc.vid = v.vid
and sc.sgid = v.sgid
and sc.mid = m.mid
and sg.psgid = 1525
and substr(t.ostdesc, instr(t.ostdesc, '阈') + 3, 3)<>'000'
and substr(t.ostdesc, instr(t.ostdesc, '阈') + 3, 3) <trim(to_char(t.speed * 0.036, '000'))
and ceil(t.speed * 0.036) < 150) a
group by a.tsgname, a.sgsgid
========================================================================
mcc_track 为二千万条数据的大表
 
后退
顶部