这句为什么执行特别慢
SQL> select sum ( charges ) from inp_bill_detail where performed_by ='34' and rcpt_no >= '90031714' and rcpt_no <= '90032590' and item_class ='A' and ordered_by ='21' ;
Elapsed: 00:00:24.38
Execution Plan
----------------------
Plan hash value: 4038433501
--------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 33 | 49972 (3)| 00:10:00 |
| 1 | SORT AGGREGATE | | 1 | 33 | | |
|* 2 | TABLE ACCESS FULL| INP_BILL_DETAIL | 1 | 33 | 49972 (3)| 00:10:00 |
--------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("PERFORMED_BY"='34' AND "ITEM_CLASS"='A' AND "ORDERED_BY"='21'
AND "RCPT_NO">='90031714' AND "RCPT_NO"<='90032590')
Note
-----
- dynamic sampling used for this statement
Statistics
----------------------
0 recursive calls
0 db block gets
219060 consistent gets
208771 physical reads
0 redo size
417 bytes sent via SQL*Net to client
396 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
------解决方案--------------------
1.重新收集一下该表(inp_bill_detail )的统计信息:
analyze table inp_bill_detail compute statistics;