Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: CURSOR_SHARING in 9i: FORCE vs. SIMILAR
Your memory that the plan should be the same for both queries when cursor_sharing = force is correct. Depending on the test sequence, though, the plan might be a tablescan or a range scan. Because of bind variable peeking, the first one through will dictate the path, and the second will follow it.
I tried to repeat your test - but only on 9.2.0.1, and whichever plan was first generated for the query after "flush shared pool", that plan persisted for all subsequence executions.
How are you checking the execution plan ?
If you use autotrace, you WILL be told about two different plans, because Oracle does not use cursor_sharing for explain plan.
e.g.
set autotrace on
select * from t1 where id = 88
Two rows appear in v$sql
EXPLAIN PLAN SET STATEMENT_ID='PLUS701' FOR select * from t1 where id = 88
select * from t1 where id = :"SYS_B_0"
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk/faq/ind_faq.html The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/seminar.html Optimising Oracle Seminar - schedule updated May 1st
So, I'm looking up differences between CURSOR_SHARING=3DFORCE (CS=3DF) = and CURSOR_SHARING=3DSIMILAR (CS=3DS) for 9.2.0.5 on HP-UX 11.11. I'm = not able to come up with a scenario to show the difference, though.
We're using CS=3DF now in 8.1.7.4.0. From the description in the "FM"s = I "R"d, I thought that perhaps CS=3DF would be bad in this case:
Using CS=3DF, the explain plan for line 6 says FTS, line 7 says range = scan on the "MYTAB_MYCOL" index. From what I've read, I thought that = CS=3DF would cause the explain plan for line 7 to FTS and that the "fix" = was to use CS=3DS.
Can anyone shed some light on this? I'm not really complaining because = the explain plans are correct, I'm just confused as usual.
TIA,
Rich
Rich Jesse System/Database Administrator rich.jesse_at_quadtechworld.com QuadTech, Sussex, WI USAPlease see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
![]() |
![]() |