select count(1) from t_customer where orgid='3' and custbirthday<>to_date('1900-10-10','yyyy-mm-dd') and to_char(custbirthday,'mm')=to_char(sysdate,'mm');
此查询请问有没有哪位大大能给我写个优化版本,数据量450W左右,而且数据经常更新,结果常变!
...全文
1077打赏收藏
oracle大数据量优化——>在线等
select count(1) from t_customer where orgid='3' and custbirthdayto_date('1900-10-10','yyyy-mm-dd') and to_char(custbirthday,'mm')=to_char(sysdate,'mm'); 此查询请问有没有哪位大大能给我写个优化版本,数据量450W左右,而且数据经常更新,结果常变!
[Quote=引用 2 楼 minitoy 的回复:]
select count(1) from t_customer where orgid='3' and (custbirthday>to_date('1900-10-10','yyyy-mm-dd')or custbirthday>to_date('1900-10-10','yyyy-mm-dd'))
and custbirthday between trunc(sysdate,'mm') a……
[/Quote]
select count(1) from t_customer where orgid='3' and (custbirthday>to_date('1900-10-10','yyyy-mm-dd')or custbirthday>to_date('1900-10-10','yyyy-mm-dd'))
and custbirthday between trunc(sysdate,'mm') and add_months(trunc(SYSDATE,'mm'),1)-1/24/60/60