我的应用程序的一种形式非常慢。在此表单中执行2查询。服务器的跟踪级别日志显示第一个查询很慢。在PL SQL中,当我使用相同的参数执行查询时,响应时间小于1秒。申请和PL的执行计划是一样的。 我不知道是什么问题。
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
计划:
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 |
--------------------------------------------------------------------------------