Return-Path: <oracle-l-bounce@freelists.org>
Delivered-To: 2-oracle-l@orafaq.com
Received: (qmail 12935 invoked from network); 12 Dec 2006 15:40:50 -0600
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by 69.64.49.119 with SMTP; 12 Dec 2006 15:40:47 -0600
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id CCE97567DB9;
 Tue, 12 Dec 2006 16:39:17 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 01610-04; Tue, 12 Dec 2006 16:39:17 -0500 (EST)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4BF5B568540;
 Tue, 12 Dec 2006 16:39:17 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Tue, 12 Dec 2006 16:38:13 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id EA9995669B3
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 16:38:12 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 01256-03 for <oracle-l@freelists.org>;
 Tue, 12 Dec 2006 16:38:12 -0500 (EST)
Received: from outbound5-blu-R.bigfish.com (outbound-blu.frontbridge.com [65.55.251.16])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 434F3560BA2
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 16:38:11 -0500 (EST)
Received: from outbound5-blu.bigfish.com (localhost.localdomain [127.0.0.1])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by outbound5-blu-R.bigfish.com (Postfix) with ESMTP id DA9EFE4218E
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 21:35:15 +0000 (UTC)
Received: from mail176-blu-R.bigfish.com (unknown [10.1.252.3])
 by outbound5-blu.bigfish.com (Postfix) with ESMTP id AA844B3004B
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 21:35:15 +0000 (UTC)
Received: from mail176-blu (localhost.localdomain [127.0.0.1])
 by mail176-blu-R.bigfish.com (Postfix) with ESMTP id 86D6A9781A9
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 21:35:15 +0000 (UTC)
X-BigFish: VP
Received: by mail176-blu (MessageSwitch) id 1165959315491995_19562; Tue, 12 Dec 2006 21:35:15 +0000 (UCT)
Received: from dsmtpg02.col.discoverfinancial.com (dsmtpg02.col.discoverfinancial.com [12.41.53.16])
 by mail176-blu.bigfish.com (Postfix) with ESMTP id 3F9C0A80060
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 21:35:15 +0000 (UTC)
Received: from dsmtpg03.novus.relay (DSMTPG03 [12.41.53.14])
 by dsmtpg02.col.discoverfinancial.com  with ESMTP id kBCLYqE89730
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 16:35:07 -0500
Received: from dfscolm02.co.discoverfinancial.com (dfscolm02.co.discoverfinancial.com [199.12.96.170])
 by dsmtpg03.novus.relay  with ESMTP id kBCLX8b74928
 for <oracle-l@freelists.org>; Tue, 12 Dec 2006 16:33:08 -0500
In-Reply-To: <FBEIIHEAOIFCBBNIIFOGKEDECGAA.mwf@rsiz.com>
Subject: How to tune this query:
To: oracle-l@freelists.org
Message-ID: <OF5C605CA3.B4375EA0-ON86257242.0073402F-86257242.007660F0@discoverfinancial.com>
From: genegurevich@discoverfinancial.com
Date: Tue, 12 Dec 2006 15:33:05 -0600
X-MIMETrack: Serialize by Router on DFSCOLM02/MSRV/DFSI(Release 7.0.1FP1|April 17, 2006) at
 12/12/2006 15:33:03
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
X-archive-position: 43081
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: genegurevich@discoverfinancial.com
Precedence: normal
Reply-to: genegurevich@discoverfinancial.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: by amavisd-new-20030616-p10 (Debian) at avenirtech.net

Hi everybody:

I'm trying to tune the following SQL and am looking for any suggestion. I
am using oracle 9204:

 create table ZZ2MQ00  as
 select a13.OFFR_CALL_ID  OFFR_CALL_ID
 from
         CCSREP.DT a12,
         CCSREP.OFFR a13,
         CCSREP.PRDCT a14,
         CCSREP.PRDCT_GRP a15
 where a13.PROC_MTH_VAL = a12.YR_MTH_NBR and
         a13.PRDCT_ID = a14.PRDCT_ID and
         a14.PRDCT_GRP_DSC = a15.PRDCT_GRP_DSC and
         a14.PRDCT_GRP_ID = a15.PRDCT_GRP_ID
  and    (a13.PREFR_IND in ('Y')
  and a13.SCRN_DSPLY_SEQ_NBR = 1
  and (not a15.PRDCT_GRP_DSC in ('product 1','product 2','product 3)
  and ((a15.PRDCT_GRP_DSC in ('Rewards')
  and a13.OFFR_RSPNS_TYP_CDE in ('A'))
  or (a13.PRDCT_ID in ('058')
  and a13.OFFR_RSPNS_TYP_CDE in ('T')))
  and (a12.YR_NBR = 2006 and a12.MTH_NBR = 11))
 group by a13.OFFR_CALL_ID
 having count(a13.OFFR_CALL_ID) > 0.0
 /

I have executed the explain plan:

---------------------------------------------------------------------------------------------------
|   0 | CREATE TABLE STATEMENT            |               |     1 |    86 |
9 |       |       |
|   1 |  LOAD AS SELECT                   |               |       |       |
|       |       |
|*  2 |   FILTER                          |               |       |       |
|       |       |
|   3 |    SORT GROUP BY                  |               |     1 |    86 |
9 |       |       |
|   4 |     NESTED LOOPS                  |               |     1 |    86 |
6 |       |       |
|   5 |      MERGE JOIN CARTESIAN         |               |     1 |    62 |
5 |       |       |
|   6 |       NESTED LOOPS                |               |     1 |    42 |
3 |       |       |
|*  7 |        TABLE ACCESS FULL          | PRDCT         |     1 |    24 |
2 |       |       |
|*  8 |        TABLE ACCESS BY INDEX ROWID| PRDCT_GRP     |     1 |    18 |
1 |       |       |
|*  9 |         INDEX UNIQUE SCAN         | PRDCT_GRP_PK  |     1 |       |
|       |       |
|  10 |       BUFFER SORT                 |               |     1 |    20 |
4 |       |       |
|* 11 |        TABLE ACCESS BY INDEX ROWID| DT            |     1 |    20 |
2 |       |       |
|* 12 |         INDEX RANGE SCAN          | DT_FK2_X      |     1 |       |
1 |       |       |
|  13 |      PARTITION RANGE ITERATOR     |               |       |       |
|   KEY |   KEY |
|* 14 |       INDEX FAST FULL SCAN        | OFFR_ALT8     |    20 |   480 |
3 |   KEY |   KEY |

This does not look too bad. The tables that are joined via a cartesian join
are small. The large table (OFFR) is
being acessed via an index OFFR_ALT8. The partition pruning seem to be used
too. The index itself is about 15G
and it has 14 partitions.

When the query is running I see a lot of waits for the db file scattered
read . The files are the ones in the tablesaces
where the index OFFR_ALT8 is located. When I check the long ops (via OEM) I
see about 30+ full scans of that index
and nothing else. vmstat shows 1% waits for IO and 80%+ idle CPU.

Any thoughts of what could be the reason for the slow performance?
-

thank you

Gene Gurevich


--
http://www.freelists.org/webpage/oracle-l


