Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: More info on sql query running slow

RE: More info on sql query running slow

From: <Rick_Cale_at_teamhealth.com>
Date: Wed, 20 Mar 2002 07:43:27 -0800
Message-ID: <F001.0042E84D.20020320074327@fatcity.com>

Hi

Only 928 records satisfy flag set ot 'Y'. Unfortuneately they have standard edition which does not support bitmap indexes. I did create an index on hold_payment_flag in my test database and the cost went from 3347 to 413. Time went from 38 seconds to 1 second. I will have to see what production does and weigh cost of adding a extra index.

Thanks
Rick

                                                                                                                   
                                                                                                           
                    <adary_at_mehish        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>       
                    .co.il>              cc:                                                                       
                    Sent by:             Subject:     RE: More info on sql query running slow                      
                    root_at_fatcity.                                                                                  
                    com                                                                                            
                                                                                                                   
                                                                                                                   
                    03/20/2002                                                                                     
                    09:38 AM                                                                                       
                    Please                                                                                         
                    respond to                                                                                     
                    ORACLE-L                                                                                       
                                                                                                                   
                                                                                                                   




Hello Rick

How many records satisfy the selection without referring to the hold_payment_flag?
How many of those have the flag set to 'y'? Are your indexes bitmaps or regular?

Of the top of my head I will build bitmap indexes for all the fields, including hold_payment_flag.

Yechiel Adar, Mehish Computer Services
adary_at_mehish.co.il

> -----Original Message-----
> From: Rick_Cale_at_teamhealth.com [SMTP:Rick_Cale_at_teamhealth.com]
> Sent: Wed, March 20, 2002 3:58 PM
> To: Multiple recipients of list ORACLE-L
> Subject: More info on sql query running slow
>
> 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:
> INET: Rick_Cale_at_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_at_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: =?iso-8859-8?Q?=E0=E3=F8_=E9=E7=E9=E0=EC?=
  INET: adary_at_mehish.co.il

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_at_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).


y筅~'"jS
+r5pzq9wtQ@_ӝRjpz
	b~牯>'z֜q,Ƣ).+-:Õ*.ǥ}bf)+-ǧuƢgˊF}\r^pN^X.+-v)鞲Ơxcr[yb(֢)CRP
Received on Wed Mar 20 2002 - 09:43:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US