How to corret an execution plan that shows wrong number of rows?
699346Jan 7 2011 — edited Jan 7 2011Using Oracle 10gR2 RAC (10.2.0.3) on SUSE Linux 9 (x86_64).
I have a partition table that has 5 million rows (5,597,831). However an execution plan against the table show that the table has 10 million rows.
Execution plan:
SELECT STATEMENT ALL_ROWS Cost : 275,751 Bytes : 443 Cardinality : 1
3 HASH GROUP BY Cost : 275,751 Bytes : 443 Cardinality : 1
2 PARTITION RANGE ALL Cost : 275,018 Bytes : 4,430,000,000 Cardinality : *10,000,000* Partition # : 2 Partitions accessed #1 - #6
1 TABLE ACCESS FULL TRACESALES.TRACE_BUSINESS_AREA Cost : 275,018 Bytes : 4,430,000,000 Cardinality : 10,000,000 Partition # : 2 Partitions accessed #1 - #6
----------------------------------------------------------
Plan hash value: 322783426
------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 443 | 275K (2)| 00:55:10 | | |
| 1 | HASH GROUP BY | | 1 | 443 | 275K (2)| 00:55:10 | | |
| 2 | PARTITION RANGE ALL| | 10M| 4224M| 275K (2)| 00:55:01 | 1 | 6 |
| 3 | TABLE ACCESS FULL | TRACE_BUSINESS_AREA | 10M| 4224M| 275K (2)| 00:55:01 | 1 | 6 |
------------------------------------------------------------------------------------------------------------
How does one correct the explain plan?
The problem: Queries against the table are taking hours to complete. The problem started when the table was dropped then recreated with a new partition.
I have complete the drop and creation against several tables for several years without problems until now.
I have done the following: Analyzed statistics against the table, flushed buffer cache. Created a materialized view.
However users queries are taking several hours to complete, where before the addition of the partition the queries where taking 5 minutes to complete.
Thanks. BL.