千万级sql优化_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 千万级sql优化

千万级sql优化

 2011/12/8 8:10:55  lucene3212  http://lucene3212.iteye.com  我要评论(0)
  • 摘要:千万级sql优化这几天在开发一个模块的时候,遇到一个棘手的问题:海量数据的查询效率问题,在下面的sql语句中,sf02表的数据在七千万左右,sf01表的数据在三千万左右,并且两个表有关联:selecta.tcol2,a.departcode,a.sendtime,sum(a.mainamount)mainamountfromsf02awherea.ksdm='11019204'andexists(selectpolicynofromsf01bwhereb
  • 标签:SQL 千万级 优化 SQL优化


千万级sql优化

这几天在开发一个模块的时候,遇到一个棘手的问题:海量数据的查询效率问题,在下面的sql语句中,sf02表的数据在七千万左右,sf01表的数据在三千万左右,并且两个表有关联:select a.tcol2, a.departcode, a.sendtime, sum(a.mainamount) mainamount  from sf02 a where a.ksdm = '11019204'  and exists (select policyno  from sf01 b  where b.businessnature = '531'  union all select policyno from sf01 b where b.businessnature = '532'  and a.policyno = b.policyno)  and (a.kindcode = 'R21' or a.kindcode = 'R29')  and a.insert_time <= to_date('2011-09-05', 'yyyy-MM-dd')  and a.insert_time >= to_date('2000-08-25', 'yyyy-MM-dd') group by a.tcol2, a.departcode, a.sendtime 由于数据库是分公司的,创建临时表不是太好使,这个问题一直没有太好的解决办法,不知道各位有没有好的思路,希望各位留下宝贵的意见,由于这个帖子放在提问区一直没有人浏览,不得已放在首页,还请blogJava对该帖放行,非常感谢。

发表评论
用户名: 匿名