Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g2KHGoS02438
 for <oracle-l@naude.co.za>; Wed, 20 Mar 2002 12:16:50 -0500
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id JAA15181;
 Wed, 20 Mar 2002 09:15:13 -0800 (PST)
Received: by fatcity.com (26-Feb-2001/v1.0g-b70/bab) via UUCP id 0042E99F; Wed, 20 Mar 2002 08:33:30 -0800
Message-ID: <F001.0042E99F.20020320083330@fatcity.com>
Date: Wed, 20 Mar 2002 08:33:30 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: Rick_Cale@teamhealth.com
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: Rick_Cale@teamhealth.com
Subject: RE: More info on sql query running slow
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 70; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Steve,

That query took about 52 seconds to run.

Thanks
Rick


                                                                                                                     
                    "Stephane                                                                                        
                    Faroult"               To:     Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>       
                    <sfaroult@oriol        cc:                                                                       
                    ecorp.com>             Subject:     RE: More info on sql query running slow                      
                    Sent by:                                                                                         
                    root@fatcity.co                                                                                  
                    m                                                                                                
                                                                                                                     
                                                                                                                     
                    03/20/2002                                                                                       
                    10:53 AM                                                                                         
                    Please respond                                                                                   
                    to ORACLE-L                                                                                      
                                                                                                                     
                                                                                                                     




Rick,

  Curious to know how this would perform :

SELECT   COUNT(a.phy_contract_id)
FROM         accrued_and_paid a,
          (select phy_contract_id
           from phy_contracts
           where company_id = 16
           and   contract_type = 'IC') b
WHERE             a.hold_payment_flag = 'Y'
AND          b.phy_contract_id   = a.phy_contract_id;


>----- Original Message -----
>From: Rick_Cale@teamhealth.com
>To: Multiple recipients of list ORACLE-L
><ORACLE-L@fatcity.com>
>Sent: Wed, 20 Mar 2002 05:58:25
>
>Hi All,
>Oracle 8.1.6
>
>I have 2 tables which have been analyzed. The query
>takes about 30+ seconds
>to run.  If I run it many times it is faster as
>data gets loaded into
>buffer
>cache. I want to optimize when that is not the
>case.          All the fields in the
>query have a separate index created EXCEPT for
>ACCRUED_AND_PAID.hold_payment_flag.
>
>Phy_Contracts has 10,466 rows.
>Accrued_and_Paid has 820,919 rows.
>
>Here is output from explain plan
>
>SELECT STATEMENT   Cost = 1382
>  SORT AGGREGATE
>    NESTED LOOPS
>      TABLE ACCESS BY INDEX ROWID PHY_CONTRACTS
>           INDEX RANGE SCAN PCON_CMPY_FK
>      TABLE ACCESS BY INDEX ROWID ACCRUED_AND_PAID
>           INDEX RANGE SCAN ADPD_PCON_FK
>
>Any ideas what I can do to speed this query.
>
>SELECT   COUNT(a.phy_contract_id)
>FROM             accrued_and_paid a, phy_contracts b
>WHERE            a.hold_payment_flag = 'Y'
>AND         b.phy_contract_id   = a.phy_contract_id
>AND         b.company_id                 = 16
>AND         b.contract_type     = 'IC';
>
>List of single column index on PHY_CONTRACTS
>INDEX_NAME                               COLUMN_NAME
>------------------------------
>---------------------
>PCON_CONTRACT_TYPE_IDX        CONTRACT_TYPE
>PCON_CMPY_FK                             COMPANY_ID
>PCON_PK                            PHY_CONTRACT_ID
>
>List of single column index on ACCRUED_AND_PAID
>INDEX_NAME                               COLUMN_NAME
>------------------------------ ------------------
>ADPD_PCON_FK                             PHY_CONTRACT_ID
>
>
>Thanks
>Rick
>
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Stephane Faroul
  INET: sfaroult@oriolecorp.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: Rick_Cale@teamhealth.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

