时间优化
---------------具体某一天--------------- select sum(t.costs) from inp_bill_detail t where t.item_id in ('23351') and to_char(t.ordered_date,'yyyy-MM-dd') = '2019-04-02'; --执行需要30s select sum(t.costs) from inp_bill_detail t where t.item_id in ('23351') and substr(t.ordered_date, 0, 10) = to_date('2019-04-02', 'yyyy-MM-dd'); --执行需要8s select sum(t.costs) from inp_bill_detail t where t.item_id in ('23351') and t.ordered_date >= to_date('2019-04-02 00:00:00','yyyy-MM-dd HH24:mi:ss')
and t.ordered_date <= to_date('2019-04-02 23:59:59','yyyy-MM-dd HH24:mi:ss'); --执行毫秒