oracle优化 per,oracle sql 语句优化

代码文本SELECT

t.aoi_name,

( SELECT count(p.per_id) FROM d_person_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.input_date > to_date('2010-10-10','yyyy-mm-dd') and p.input_date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_person,

( SELECT count(p.per_id) FROM d_body_check_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.BCI_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.BCI_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_bodycheck,

( SELECT count(p.per_id) FROM D_NEWBORN_HOME_VISIT p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.new_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.new_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_born,

( SELECT count(p.per_id) FROM D_oneChild_health_exam p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.OC_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.OC_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_one,

( SELECT count(p.per_id) FROM D_twoChild_health_exam p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.TWC_visitDate > to_date('2010-10-10','yyyy-mm-dd') and p.TWC_visitDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_two,

( SELECT count(p.per_id) FROM D_CHILD_HEALTH_EXAM p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.CHE_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.CHE_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_six,

( SELECT count(p.per_id) FROM D_FIRST_follow_service p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.ffs_fillDate > to_date('2010-10-10','yyyy-mm-dd') and p.ffs_fillDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_first,

( SELECT count(p.per_id) FROM D_follow_service_info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.fts_wVisDate > to_date('2010-10-10','yyyy-mm-dd') and p.fts_wVisDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_second,

( SELECT count(p.per_id) FROM D_Postpartum_visits p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.pv_followDate > to_date('2010-10-10','yyyy-mm-dd') and p.pv_followDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_postpartum,

( SELECT count(p.per_id) FROM D_Postpartum_healthCheck p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.phc_followDate > to_date('2010-10-10','yyyy-mm-dd') and p.phc_followDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_postpartum_health,

( SELECT count(p.per_id) FROM D_DPF_Record_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.DPF_Date > to_date('2010-10-10','yyyy-mm-dd') and p.DPF_Date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_dpf,

( SELECT count(p.per_id) FROM D_HPFS_RECORD_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.HPF_DATE > to_date('2010-10-10','yyyy-mm-dd') and p.HPF_DATE < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_hpfs,

( SELECT count(p.per_id) FROM D_GMIP_Follow_INFO p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.GMF_FollowDate > to_date('2010-10-10','yyyy-mm-dd') and p.GMF_FollowDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_gmf,

( SELECT count(p.per_id) FROM D_Infectious_DIS p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.DID_DDate > to_date('2010-10-10','yyyy-mm-dd') and p.DID_DDate < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_infectious,

( SELECT count(p.per_id) FROM D_Older_Case_Info p, m_user_info u WHERE u.aoi_id = t.aoi_id and u.user_id = p.input_user and p.valid = '1' and p.OLDC_follow_Date > to_date('2010-10-10','yyyy-mm-dd') and p.OLDC_follow_Date < to_date('2012-10-10','yyyy-mm-dd')+1 ) v_older

FROM m_admin_organ_info t , s_organ_info b

WHERE t.org_id = b.org_id

and t.valid = '1' and t.area_sid like '36012210%' and b.ole_id='2'分割线

数据有百万,经理说

针对你的查询条件 来建立所以

一般where

里面包含的 条件建立个索引

会快一点分割线

但是这么优化啊。 谁能告诉我。 我真心不知道这么来做。 索引啥的。基本不是很会。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值