create table T_SP_SERVICE_ACCESSLIST
(
FID
NUMBER(20) not null,
FUSERID NUMBER(20) not null,
FSERVICEIDNUMBER(20) not null,
FLASTACCESSTIME TIMESTAMP(6) not null
)
tablespace PLATFORM_DEV
pctfree 10
initrans 5;
--临时sequence
create sequence SEQ_TMP_ACCESSLISTstart with 1;
insert into t_sp_service_accesslist
(fid, fuserid, fserviceid, flastaccesstime)
select SEQ_TMP_ACCESSLIST.Nextval fid,
a.fuserid,
a.fserviceid,
a.flastaccesstime
from (select fuserid,
t.fserviceid fserviceid,
max(t.flastaccesstime) flastaccesstime
from t_sp_accesslog t
group by fuserid, t.fserviceid) a
update t_common_sequence cs
set cs.fmaxvalue = SEQ_TMP_ACCESSLIST.Nextval + 10000
where ftype = 'T_SP_SERVICE_ACCESSLIST';
-- Create/Recreate primary, unique and foreign key constraints
alter table T_SP_SERVICE_ACCESSLIST
add primary key (FID)
using index
tablespace PLATFORM_DEV
pctfree 20
initrans 10;
create unique index idx_uk_user_serviceid on T_SP_SERVICE_ACCESSLIST (fuserid, fserviceid);
drop sequence SEQ_TMP_ACCESSLIST;
请教下using index的作用是什么
|