- 论坛徽章:
- 0
|
碰到一个问题,不知如何解决,请大侠们不吝指教,谢谢。
问题描述:下面的sql在存储过程中执行要15s,在qc客户端上执行只要1s ,其中表的数据200w条记录级。增加了用户临时表空间页数,也没有作用。 那位大侠指导一下。
INSERT INTO SESSION.results (control
,sycompsystid
,tobasystid
,thisbuy
-- ,thissale
--,thisdemand
)
select
-2 as control
,c.company_id as sycompsystid
,b.tobacco_id as tobasystid
,sum(cgt_pur_qty)/5
from gj_jxc a
inner join session.tp_tobacco b on a.CGT_CARTON_CODE = b.bandcode
inner join SESSION.TP_COMPANY c on a.org_code = c.gj_code
where reportdate between p_BeginDate and p_endDate
group by c.company_id
,b.tobacco_id
; |
|