0

One form of my application in very slow . In this form 2 query be executed. Trace level log of server show that first query is slow . in PL SQL when I execute query with same parameter , response time is less than 1 second. execution plan of application and PL is same. I don't know what is the problem.

INFO  962.50.0.1 2017-10-17 10:54:56,144 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - com.tosan.sipa.framework.security.authentication.ipAddress.TrustedIpConfigBasedAuthentication - Ip address 192.168.7.126 is valid for this request
INFO  962.50.0.1 2017-10-17 10:54:56,151 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - com.tosan.backoffice.cms.connector.webservice.hessian.CMSFacadeImpl - GetDubiousCardListRequest{filter=DubiousCardFilterDto{cardPAN='null',cardIssueDate='null', traceNo='null', mainApplicationType='null', cardOwnerId=null, branchCode=null, userCode=null, cardStatus=null, holderId=1010, multipurpose=null'}}
DEBUG 962.50.0.1 2017-10-17 10:54:56,167 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - org.hibernate.SQL -
    select
        *
    from
        ( select
            count(*) as col_0_0_
        from
            PSAM962.KCCARDS ecards0_,
            PSAM962.KCSRVCCALL eserviceca1_,
            PSAM962.KC3CNTC econtact2_
        where
            eserviceca1_.SCSTS=?
            and eserviceca1_.SCOPRTNCOD=?
            and ecards0_.CDPHYSSTS=?
            and ecards0_.CDSTS<>?
            and (
                ecards0_.CDSTS<>?
                or ecards0_.CDSTSINFO<>?
            )
            and ecards0_.CDCARDNO=substr(eserviceca1_.SCRSENTYKEY, instr(eserviceca1_.SCRSENTYKEY, '.')+1)
            and ecards0_.SWITCHCODE=substr(eserviceca1_.SCRSENTYKEY, 1, instr(eserviceca1_.SCRSENTYKEY, '.')-1)
            and eserviceca1_.SCCALLDAT=(
                select
                    max(eserviceca3_.SCCALLDAT)
                from
                    PSAM962.KCSRVCCALL eserviceca3_
                where
                    eserviceca3_.SCRSENTYKEY=eserviceca1_.SCRSENTYKEY
            )
            and ecards0_.CDISUDT=(
                select
                    max(ecards4_.CDISUDT)
                from
                    PSAM962.KCCARDS ecards4_,
                    PSAM962.KCSRVCCALL eserviceca5_
                where
                    ecards4_.CDCARDNO=substr(eserviceca5_.SCRSENTYKEY, instr(eserviceca5_.SCRSENTYKEY, '.')+1)
                    and ecards4_.SWITCHCODE=substr(eserviceca5_.SCRSENTYKEY, 1, instr(eserviceca5_.SCRSENTYKEY, '.')-1)
                    and eserviceca5_.SCPERTRCNO=eserviceca1_.SCPERTRCNO
            )
            and ecards0_.CDHLDRID=econtact2_.K3016ID
            and ecards0_.CDHLDRID=?
        )
    where
        rownum <= ?
DEBUG 962.50.0.1 2017-10-17 10:55:27,982 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - org.hibernate.SQL -
    select
        *
    from
        ( select
            ecards0_.CDCARDNO as col_0_0_,
            ecards0_.CDHLDRID as col_1_0_,
            ecards0_.CBC_CFCIFNO as col_2_0_,
            ecards0_.CDISUDT as col_3_0_,
            ecards0_.CDEXPIRE as col_4_0_,
            ecards0_.CDSTS as col_5_0_,
            ecards0_.CDISSRBRNCOD as col_6_0_,
            ecards0_.CDISSRUSRCOD as col_7_0_,
            eserviceca1_.SCPERTRCNO as col_8_0_,
            ecards0_.CDISMLTIPRPS as col_9_0_,
            ecards0_.CDMAINAPPTYP as col_10_0_,
            ecards0_.CDMEDTYP as col_11_0_,
            econtact2_.K3016NAM as col_12_0_,
            econtact2_.K3016SNAM as col_13_0_
        from
            PSAM962.KCCARDS ecards0_,
            PSAM962.KCSRVCCALL eserviceca1_,
            PSAM962.KC3CNTC econtact2_
        where
            eserviceca1_.SCSTS=?
            and eserviceca1_.SCOPRTNCOD=?
            and ecards0_.CDPHYSSTS=?
            and ecards0_.CDSTS<>?
            and (
                ecards0_.CDSTS<>?
                or ecards0_.CDSTSINFO<>?
            )
            and ecards0_.CDCARDNO=substr(eserviceca1_.SCRSENTYKEY, instr(eserviceca1_.SCRSENTYKEY, '.')+1)
            and ecards0_.SWITCHCODE=substr(eserviceca1_.SCRSENTYKEY, 1, instr(eserviceca1_.SCRSENTYKEY, '.')-1)
            and eserviceca1_.SCCALLDAT=(
                select
                    max(eserviceca3_.SCCALLDAT)
                from
                    PSAM962.KCSRVCCALL eserviceca3_
                where
                    eserviceca3_.SCRSENTYKEY=eserviceca1_.SCRSENTYKEY
            )
            and ecards0_.CDISUDT=(
                select
                    max(ecards4_.CDISUDT)
                from
                    PSAM962.KCCARDS ecards4_,
                    PSAM962.KCSRVCCALL eserviceca5_
                where
                    ecards4_.CDCARDNO=substr(eserviceca5_.SCRSENTYKEY, instr(eserviceca5_.SCRSENTYKEY, '.')+1)
                    and ecards4_.SWITCHCODE=substr(eserviceca5_.SCRSENTYKEY, 1, instr(eserviceca5_.SCRSENTYKEY, '.')-1)
                    and eserviceca5_.SCPERTRCNO=eserviceca1_.SCPERTRCNO
            )
            and ecards0_.CDHLDRID=econtact2_.K3016ID
            and ecards0_.CDHLDRID=?
        )
    where
        rownum <= ?
INFO  962.50.0.1 2017-10-17 10:55:28,106 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - com.tosan.backoffice.cms.connector.webservice.hessian.CMSFacadeImpl - GetDubiousCardListResponse{DubiousCardViewList=[]}
INFO  962.50.0.1 2017-10-17 10:55:28,107 - 33ee31c1-b81b-41c3-ad5b-20ac0a38e154 - 192.168.7.126:22704 - com.tosan.backoffice.cms.connector.webservice.hessian.CMSFacadeImpl - Return value of getDubiousCardList method

PLAN:

SQL>  select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
| Id  | Operation                               | Name             | Rows  | Byt
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                        |                  |     1 |
|   1 |  COUNT STOPKEY                          |                  |       |
|   2 |   VIEW                                  |                  |     1 |
|   3 |    SORT AGGREGATE                       |                  |     1 |
|   4 |     VIEW                                | VM_NWVW_2        |     1 |
|   5 |      FILTER                             |                  |       |
|   6 |       HASH GROUP BY                     |                  |     1 |   2
|   7 |        FILTER                           |                  |       |
|   8 |         NESTED LOOPS                    |                  |     1 |   2
|   9 |          NESTED LOOPS                   |                  |     1 |   2
|  10 |           NESTED LOOPS                  |                  |     1 |   1
|  11 |            HASH JOIN                    |                  |     1 |   1
|  12 |             NESTED LOOPS                |                  |     1 |
|  13 |              INDEX UNIQUE SCAN          | PK_KC3CNTC       |     1 |
|  14 |              TABLE ACCESS BY INDEX ROWID| KCCARDS          |     1 |
|  15 |               INDEX RANGE SCAN          | ESH_CDHLDRID     |     1 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
|  16 |             TABLE ACCESS FULL           | KCSRVCCALL       | 12987 |   9
|  17 |            TABLE ACCESS BY INDEX ROWID  | KCSRVCCALL       |   236 | 115
|  18 |             INDEX RANGE SCAN            | KCSRVCCALL_IDX01 |     2 |
|  19 |           INDEX UNIQUE SCAN             | PK_KCCARDS       |     1 |
|  20 |          TABLE ACCESS BY INDEX ROWID    | KCCARDS          |     1 |
|  21 |         SORT AGGREGATE                  |                  |     1 |
|  22 |          TABLE ACCESS BY INDEX ROWID    | KCSRVCCALL       |     1 |
|  23 |           INDEX RANGE SCAN              | ESH_1            |     1 |
--------------------------------------------------------------------------------
Mahsa ehsani
  • 117
  • 12
  • Do you return a single row from a table having 12987 rows? Can you be more specific about the RDBMS you are using and the ways you are running the query? – Lajos Arpad Oct 17 '17 at 06:54
  • no. maybe more than one row be returned. i have search box in my application , with no filter every thing is OK , just when i filter ecards0_.CDHLDRID = '1010' response time of my application become about 1 minute , same query with this filter in PL run in less than 1 second – Mahsa ehsani Oct 17 '17 at 07:29

0 Answers0