I have a query in oracle leading to a high estimated cost in an OLAP system. the estimated row number is only 100K but the cost is a huge number. I wonder how the number of cost is calculated and in which situation a super high estimated cost will happen?
The execution plan:
17 TABLE ACCESS BY LOCAL INDEX ROWID /BIC/FZ3PM_C01
| ( Estim. Costs = 1,299,922,942,955,190 , Estim. #Rows = 104,711 )
| Pstart: 1 Pstop: 471
| Estim. CPU-Costs = 18,446,744,073,709,601,000 Estim. IO-Costs = 86,157,375,
|
--- 16 BITMAP CONVERSION TO ROWIDS
|
--- 15 BITMAP AND
|
|-- 7 BITMAP MERGE
| |
| --- 6 BITMAP KEY ITERATION
| |
| |-- 4 BUFFER SORT
| | |
| | ------3 TABLE ACCESS FULL /BIC/DZ3PM_C012
| | ( Estim. Costs = 4 , Estim. #Rows = 180 )
| | Estim. CPU-Costs = 1,093,126 Estim. IO-Costs = 4
| | Filter Predicates
| |
| ------5 BITMAP INDEX RANGE SCAN /BIC/FZ3PM_C01~050
| Pstart: 1 Pstop: 471
| Search Columns: 1
| Access Predicates
|
--- 14 BITMAP MERGE
|
--- 13 BITMAP KEY ITERATION
|
|-- 11 BUFFER SORT
| |
| --- 10 HASH JOIN
| | ( Estim. Costs = 2,492 , Estim. #Rows = 1,264,100 )
| | Estim. CPU-Costs = 801,483,146 Estim. IO-Costs = 2,407
| | Access Predicates
| |
| |-----8 TABLE ACCESS FULL /BI0/XMATERIAL
| | ( Estim. Costs = 1,470 , Estim. #Rows = 50,880 )
| | Estim. CPU-Costs = 403,451,418 Estim. IO-Costs = 1,427
| | Filter Predicates
| ------9 TABLE ACCESS FULL /BIC/DZ3PM_C011
| ( Estim. Costs = 1,007 , Estim. #Rows = 1,264,100 )
| Estim. CPU-Costs = 259,249,328 Estim. IO-Costs = 980
|
------12 BITMAP INDEX RANGE SCAN /BIC/FZ3PM_C01~040
Pstart: 1 Pstop: 471
Search Columns: 1
Access Predicates
The 100,000 estimated rows is the output. It may need to do a lot of work to filter a large dataset down to that and even more to summarise a large dataset. That said, those costs are pretty astronomical (even with a database with a data size requiring 400+ partitions)
Try doing the explain plan and then a SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY)
This provides a much more readable plan. You want all the access and filter predicates to see what it is doing, and the costs as they are summarized up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With