高手帮忙看一个表索引问题。用索引查询反而更慢了 -- Create table create table Test ( UA NUMBER(20) not null, PPID NUMBER(8) not null, MSG_ID NUMBER(5) not null, PRIORITY NUMBER(2) default 64, LASTSEND_DATE DATE not null, MSG_DATA VARCHAR2(2048) not null, MSG_INLIST NUMBER(1) default 0, MODIFY_PRIORITY NUMBER(2) default 60 not null ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited );
-- Create/Recreate primary, unique and foreign key constraints alter table Test add constraint Test_KEY primary key (UA, PPID, MSG_ID) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited );
-- Create/Recreate indexes create index Test_INDEX on Test (MODIFY_PRIORITY, LASTSEND_DATE) tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited ); 我用如下语句查询,select * from test where MSG_INLIST = 0 order by modify_priority,lastsend_date 1000万数据执行要1个小时,为什么呢,我是用索引排序的啊