我有一个高成本的查询,这个成本出现在我分区我的数据库之后。我不知道是什么造成了这个问题。分区是在日期。
查询是:
update EBSESSIONSERVICE set RESPONSETIME=:1 , DURATION=:2 where ID=:3 and REQUESTTIME>sysdate-:4
和EBSESSIONSERVICE表是:
create table EBSESSIONSERVICE ( id NUMBER(19) not null, description VARCHAR2(200 CHAR), requesttime TIMESTAMP(6) not null, responsetime TIMESTAMP(6), serviceid NUMBER(19), failurereasonid NUMBER(19), sessionid NUMBER(19), duration NUMBER(19), error_code VARCHAR2(50), requested_amount NUMBER(19,2), applied_amount NUMBER(19,2), sub_service_id VARCHAR2(50), sub_service_title VARCHAR2(100), instance_number NUMBER(19), sub_system_type NUMBER(2), currency VARCHAR2(255 CHAR) ) partition by range (REQUESTTIME) ( partition P1 values less than (TIMESTAMP' 2010-01-21 00:00:00')
tablespace PERF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 8M
next 1M
minextents 1
maxextents unlimited
), partition SYS_P27331 values less than (TIMESTAMP' 2010-12-15 00:00:00')
tablespace PERF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 8M
next 1M
minextents 1
maxextents unlimited
),
.
.
.
.
.
-- Create/Recreate indexes
create index IDX_SS_AMOUNT on EBSESSIONSERVICE (REQUESTED_AMOUNT)
local;
create index IDX_SS_REQUESTTIME on EBSESSIONSERVICE (REQUESTTIME)
local;
create index IDX_SS_SERVICEID on EBSESSIONSERVICE (SERVICEID)
local;
create index IDX_SS_SESSIONID on EBSESSIONSERVICE (SESSIONID)
local;
create index SYS_C0 0100184 on EBSESSIONSERVICE (ID)
local;
当我为sysdate设置3-4时,成本是正常的,但是当我使用sysdate大约60时,成本增加到1400。 sysdate是集合的最大值,在这种情况下大约是一天,因此where子句中的条件仅包含1或2个portition。为什么这个查询的成本如此之高?