Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

to slow or not to slow

Henrie CuijpersSep 29 2008 — edited Sep 30 2008
Hi All,

My Query explains to some execution-plan with cost: 129. It takes minutes to return the first row. When i add a hint the execution plan says the cost is 151 and the query returns with all rows within a few milliseconds.

Statistics are gathered each morning between 05:00 and 06:00 with gather_stats package for 10% of the rows.

Here are the numbers (look at the consitent gets):
WITH HINT:
response-time average 35 milliseconds
Consistent Gets 1806
Physical Reads 499 (Drops to 0 on repeated executions.)
rows-returned: 29 (Varies a bit because of live-data)
WITHOUT HINT:
response-time 8min:51 (times between 7 to 10 minutes)
Consistent Gets 651051
Physical Reads 1381
rows-returned 30

Why does the optimizer calculate a plan which costs less but upon execution appears to be not right? And more important: where should i start looking to get the optimizer choose the better plan..

Regards,
hcHoep
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 28 2008
Added on Sep 29 2008
16 comments
572 views