Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: CBO & different execution plans
On Mar 10, 6:20 pm, "Matthias Hoys" <a..._at_spam.com> wrote:
> We are not using VPD. But you are right, the public synonyms point to
> different objects, it seems like the application has some built-in security
> layer. Still, those extra security tables are very small, so I'm still
> searching why the query runs fast on Oracle 8i and slow on 10g (with roughly
> the same CBO settings and statistics). I found out that, if I add the
> HTS_ASSAY_RESULT table to the end of the table list in the FROM part of the
> query, the query always executes fast. However, I can't modify the
> application code. And no matter what CBO settings or statistics that I use,
> Oracle 10g generates a non-performant execution plan. Only by rewriting the
> query, it's executed fine ... So I'm a bit stuck here ... Maybe stored
> outlines could help ?
>
> Matthias
FROM
HTS_ASSAY_RESULT R, HTS_ASSAY_RESULT_TYPE ART, HTS_ASSAY_PROTOCOL AP , HTS_ASSAY A, HTS_COMPOUND_LOT CL
R.EXPERIMENT_ID, R.RESULT_ID, R.PARENT_RESULT_ID,
In the slow running execution:
The public synonymn for HTS_ASSAY_RESULT points to
HTS_SECURE_ASSAY_RESULT view
HTS_SECURE_ASSAY_RESULT view contains a reference to:
HTS_ASSAY HTS_ASSAY_PROTOCOL HTS_ASSAY_RESULT
When the tables are joined in the order indicated in the slow running execution, Oracle does not have any way to constrain the 2,377,609 rows in the HTS_ASSAY_RESULT table until the view is finally combined with the row set results of the other tables. My guess is that Oracle is predicting that the cardinality coming out of the HTS_SECURE_ASSAY_RESULT view will be very high, so it selects to join this view last, rather than third as in the fast running execution.
What you might try to do is execute a 10053 trace at level 1 when executing the above SQL statement as a user who is not the schema owner. Then, alter the optimizer_features_enabled parameter for the session to 8.1.7 and eexcute another 10053 trace at level 1 when executing the above SQL statement. If the above SQL statement executes quickly with optimizer_features_enabled set to 8.1.7, examine the two trace files. The trace files will list all parameters, including hidden parameters, that were in effect during the execution of the SQL statement. Compare the parameters between the two runs - where differences exist, you are seeing the parameters that changed automatically when optimizer_features_enabled was changed. By starting a new session and altering that session one parameter at a time before each execution of the SQL statement, you may be able to find the parameter that corrects the problem. If you find the problematic parameter, you could create a logon trigger that sets the necessary session level parameters when that application module runs.
If you post a dump of the optimizer parameters, someone may be able to identify the parameter that is affecting the join order.
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Sun Mar 11 2007 - 10:22:22 CDT
![]() |
![]() |