Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've had similar experiences and while I have no general solution, I would suggest the following:</p> <ul> <li><p>run "SELECT * FROM v$parameter2;" and make sure that _complex_view_merging is on. There was a nasty bug in one of the early 10g releases that was related to it so some dbas turned it off and might have forgotten to turn it back on once it was fixed.</p></li> <li><p>Leave all consideration about hints as a last measure. In my experience, they're rarely useful for preventing full table scans because the optimizer is already doing everything it can to avoid them.</p></li> <li><p>If you have a base table whose primary key is what you're ultimately going to be filtering the view on, try to set things up so that your view's main query starts with that and then joins to your complicated with clause queries, <em>even if that join is completely redundant</em> (i.e. give oracle a chance to do easy filtering on that base table before joining to the complicated bits). Make sure that the columns that the view is going to be filtered on are selected directly from that base table and not the complicated_query. So something like</p></li> </ul> <p>.</p> <pre><code> with (complicated_query) select base_table.key1, complicated_query.* from base_table join complicated_query on base_table.key1 = complicated_query.key1; </code></pre> <ul> <li><p>If you have filters that use an uncorrelated subquery, try switching them to a correlated equivalent (and vice versa).</p></li> <li><p>Play around with the order of your join statements and/or which table you start out with in your FROM clause, even if logically it will not make a difference to the outcome. This is a bit of a desperate gambit, but I've definitely had execution plans change for the better by doing this. Optimizing Oracle queries is not always a rational process.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload