Return-Path: <oracle-l-bounce@freelists.org>
Delivered-To: 2-oracle-l@orafaq.com
Received: (qmail 668 invoked from network); 19 Jul 2007 02:25:22 -0500
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by 69.64.49.119 with SMTP; 19 Jul 2007 02:25:21 -0500
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8542971590B;
 Thu, 19 Jul 2007 03:23:07 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 20973-09; Thu, 19 Jul 2007 03:23:07 -0400 (EDT)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 08A487158DB;
 Thu, 19 Jul 2007 03:23:06 -0400 (EDT)
Received: with ECARTIS (v1.0.0; list oracle-l); Thu, 19 Jul 2007 02:41:29 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 11CB3714C28
 for <oracle-l@freelists.org>; Thu, 19 Jul 2007 02:41:29 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 10254-02 for <oracle-l@freelists.org>;
 Thu, 19 Jul 2007 02:41:29 -0400 (EDT)
Received: from web52009.mail.re2.yahoo.com (web52009.mail.re2.yahoo.com [206.190.48.58])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with SMTP id 54ED0714B11
 for <oracle-l@freelists.org>; Thu, 19 Jul 2007 02:41:27 -0400 (EDT)
Received: (qmail 44151 invoked by uid 60001); 19 Jul 2007 06:43:37 -0000
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID;
  b=oUJZHTuaD8FHIl+Ij2i91zglskuPsJCboDAketJnVZNSxLDL4oWOg64dKqLnS852GXoeiD3tXdw1kaI9gm88dGON3aoaNKqwhjbaJKq/46nd627svRj+AyTniwEy+bsoikkjkBqIvsTnzx24nLVSZ+IxU9AJgQ1FA+2bS72WyXU=;
X-YMail-OSG: 1CbkOfsVM1n68JQ3C9GsGPps.zNtYFuemvY9hnRz62s91wEdvyRtmFHHIZ3Plb2gTk544ZnGhVuqqFCgh.8zBc_1jFpCd6XZIPjUnru7cFTxSRhr68r9h7BtxyPc
Received: from [202.65.241.254] by web52009.mail.re2.yahoo.com via HTTP; Wed, 18 Jul 2007 23:43:37 PDT
Date: Wed, 18 Jul 2007 23:43:37 -0700 (PDT)
From: Tomi Wijanto <restomi_w@yahoo.com>
Subject: Plan changing after database restart
To: oracle-l@freelists.org
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Message-ID: <927183.43635.qm@web52009.mail.re2.yahoo.com>
X-archive-position: 51027
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: restomi_w@yahoo.com
Precedence: normal
Reply-to: restomi_w@yahoo.com
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-subscribe: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:steve.adams@ixora.com.au>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l
X-Virus-Scanned: Debian amavisd-new at localhost.localdomain

Hi all,

I have weird problem for one SQL query, which has
different execution plan before and after restarting
database.
  Before restart, it use NESTED LOOP (ANTI JOIN) and
never completed (total logical reads > 1 billion).
  After restart, it use HASH JOIN (RIGHT ANTI) and
complete in 2 minutes.
Optimizer environment was exactly same. Job was
running from sqlplus. There is no histogram also.

My concern is not about how to optimize this query,
but more about WHY the execution plan is different
before and after restarting db.

The only difference I aware was:
Before restart, most of the table and indexes were
already in memory.
But could it impact execution plan?

Your input is highly appreciated.

Best Regards,
tomi


Query:
-----
select 
  w.rowid r_id, w.acc, w.prod, w.system_account 
from 
  mytab w 
where 
  w.brn=:b1 
  and not exists ( 
    select 1 
    from myview v 
    where v.brn=w.brn and v.acc=w.acc and
v.prod=w.prod );

view 'myview' is a complex view with union (all) of
three subqueries.


       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/
--
http://www.freelists.org/webpage/oracle-l


