As usual very informative
Shah Firdous, February 19, 2016 - 5:59 pm UTC
Thank you so much for helping the best way.
You gave me perfect solution for my Ist question, but
Here is something I wanted to clarify:
My Table stats are upto mark no stale stats.
I am not using bind variable in this test case
It might be something related to BUG or optimizer problem.
---------------------------------------------------
Optimizer seems to be dumb, When I run query, it doesn't execute it parallel, but when I add HINT parallel, the optimiser determines the a DOP of 2 is most efficient.
Why it didn't do it first place, why should it think differently now when I use HINT Parallel 2.
Just to make a point
SQL> explain plan for
2 select * from int_transactions;
Explained
SQL> SELECT * FROM table(DBMS_XPLAN.DISPLAY('Plan_table','','ALL'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3491809280
--------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 231M| 116G| 1179K (1)| 00:01:11 | | | | | |
| 1 | PX COORDINATOR | | | | | | | | | | |
| 2 | PX SEND QC (RANDOM)| :TQ10000 | 231M| 116G| 1179K (1)| 00:01:11 | | | Q1,00 | P->S | QC (RAND) |
| 3 | PX BLOCK ITERATOR | | 231M| 116G| 1179K (1)| 00:01:11 | 1 | 80 | Q1,00 | PCWC | |
| 4 | TABLE ACCESS FULL| INT_TRANSACTIONS | 231M| 116G| 1179K (1)| 00:01:11 | 1 | 80 | Q1,00 | PCWP | |
--------------------------------------------------------------------------------------------------------------------------------------
This query table scans a table that is about 116GB, it would take about an hour in our environment. The optimiser thinks it will run in 71 seconds. As far as I can see, the DB thinks the I/O is MUCH faster than it actually is….
My Question here is : What should I do with optimizer bugs or optimizer problem, Can we really do something about bad optimizer?
*Please don't mind this query is just an example to prove optimizer issue* else y should one use select * for such a big table*
Thanks for helping.
Regards,
Shah
February 20, 2016 - 4:16 am UTC
Check out your *system* stats as well. They give a measure of how good we think your I/O system is. If it really *isnt* that good...then the optimizer will be obviously less accurate.