Re: Oracle - UNNEST-Hint



On 19 Nov 2005 04:43:43 -0800, "Florian Melcher" <homervondensimpsons@xxxxxx>
wrote:

>jetzt aber hoffentlich meine letzte Frage (ich kämpfe mich gerade
>durch die Untiefen der Oracle-Doku ;-) )
>
>Ich bin bei den Hints zur Steuerung des Optimizers über ,,UNNEST"
>gestossen, mir ist aber nicht ganz klar, was es bewirkt. In der Doku
>steht:
>
>,,The UNNEST hint specifies subquery unnesting. Subquery unnesting
>unnests and merges the body of the subquery into the body of the
>statement that contains it, allowing the optimizer to consider them
>together when evaluating access paths and joins."
>
>Bedeutet dass, das meine Subquery quasi "aufgelöst" wird und die
>Gesamtabfrage somit wesentlich schneller ausgeführt wird? Kann mir
>jemand den Ablauf hierbei etwas genauer veranschaulichen?

Der Optimizer schreibt Dein Statement um. Eine Subquery wird zu einem Join
umgebaut, Zwiebelschalen werden aufgelöst.

>
>Was sind die Vor- bzw. Nachteile?

Ziel ist es, einen effizienteren Zugriffspfad zu finden. Der Optimizer
kalkuliert eine Unzahl unterschiedlicher Zugriffspfade durch und entscheidet
sich dann für denjenigen, der ihm als der ressourcenschonendste erscheint.

Manchmal (aber immer seltener) muß/kann man dem Optimizer mit einem Hint auf die
Sprünge helfen. Solange Du nicht weißt, dass der Optimizer einen ungünstigen
Pfad eingeschlagen hat (EXPLAIN PLAN, SQL-Trace etc blabla), lass die Finger
davon.


--
Marc Blum
mailto:blumXXXSPAMXXX@xxxxxxxxxxx
http://www.marcblum.de
.



Relevant Pages

  • Re: Exists
    ... tested in the subquery and returns that in EXISTS predicate. ... but probably will not in most products with a good optimizer. ... And the next execution of the same query could change the method used, ... based on statistics or a new optimizer or a new access method. ...
    (microsoft.public.sqlserver.programming)
  • Re: Query Help
    ... > multiple times in one query, or when updating multiple columns using ANSI ... yet the optimizer chose to execute it multiple times. ... > consider an execution plan where the subquery gets evaluated only once. ... switch to yukon now. ...
    (microsoft.public.sqlserver.programming)
  • Re: Query Help
    ... Funny though that the optimizer doesn't consider a plan where the view is ... multiple times in one query, or when updating multiple columns using ANSI ... optimizer should be able to compare subqueries used in a query, ... consider an execution plan where the subquery gets evaluated only once. ...
    (microsoft.public.sqlserver.programming)
  • Re: Make count = 0 where no row is returned.
    ... Correlated subqueries are generally less efficient than joins. ... subquery: for a general correlated subquery, you start from scratch for each ... and finally move down to the next name in the first book. ... to be done by the optimizer if you use subquery, ...
    (microsoft.public.access.queries)
  • Re: Oracle Hint Behavior
    ... Oracle would treat them as only "suggestions" but I thought in 10g they ... like to be able to explain why the hint is being ignored now. ... There is an interesting way to influence the optimizer without the use ... of DEC Rdb right after Oracle acquired Rdb back in '94/'95 timeframe. ...
    (comp.databases.oracle.server)