我们公司的数据库有一个名为" TEMP_EMP_ATTENDANCE"的表格。它这次有大约600000条记录,而且系统每天为员工出勤记录增加约3500条记录。因此,当我们进行考勤计算过程时,整个数据库以及应用程序变得太慢,每个班次大约需要2.5到3小时。我们可以做些什么来加快处理速度?
表说明:
CREATE TABLE SYSTEM.TEMP_EMP_ATTENDANCE (
CM_CODE NUMBER(2, 0) NOT NULL,
EAE_MONTH NUMBER(2, 0) NOT NULL,
EAE_YEAR NUMBER(4, 0) NOT NULL,
EAE_EM_ID NUMBER(8, 0) NOT NULL,
EAE_EMP_ID VARCHAR2(50 BYTE),
EAE_REG_NO VARCHAR2(6 BYTE),
EM_NAME VARCHAR2(100 BYTE),
EAE_DATE TIMESTAMP(6) NOT NULL,
EM_TYPE_CODE NUMBER(4, 0),
EG_ID NUMBER(4, 0),
PH_CODE NUMBER(4, 0),
DEPT_CODE NUMBER(4, 0),
SUBDEPT_CODE NUMBER(4, 0),
SHIFT_ID NUMBER(4, 0),
SCH_INTIME TIMESTAMP(6),
SCH_OUTTIME TIMESTAMP(6),
IN_TIME TIMESTAMP(6),
OUT_TIME TIMESTAMP(6),
DAY NUMBER(5, 2),
LATE_TIME NUMBER(15, 2),
OVER_TIME NUMBER(15, 2),
EAE_EM_RESTDAY VARCHAR2(10 BYTE),
DAILY_STATUS VARCHAR2(30 BYTE),
LTM_CODE NUMBER(4, 0),
BMANUALUPDATEINOUTTIME NUMBER(1, 0),
TOTAL_PUNCH NUMBER(3, 0),
REMARK VARCHAR2(1000 BYTE),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEMREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64KREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITEDREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEMREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64KREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITEDREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEMREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEM
STORAGE (REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64KREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITEDREMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)REMARK VARCHAR2(1000 BYTE),
WORK_HOURS NUMBER(4, 2),
ENT_DATE DATE,
USER_ID NUMBER(8, 0),
DM_ID NUMBER(4, 0),
LATE_GOING NUMBER(15, 2),
DAY_STATUS VARCHAR2(1 BYTE),
CONSTRAINT TEMP_EMP_ATTENDANCE_O_PK PRIMARY KEY (CM_CODE, EAE_EM_ID, EAE_DATE, EAE_MONTH, EAE_YEAR) USING INDEX TABLESPACE SYSTEM STORAGE ( INITIAL 64K MAXEXTENTS UNLIMITED ))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE INDEX SYSTEM.IND_TEMP_DAILY2_O ON SYSTEM.TEMP_EMP_ATTENDANCE (CM_CODE, EAE_EM_ID, EAE_DATE, EM_TYPE_CODE, EG_ID, DEPT_CODE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
CREATE UNIQUE INDEX SYSTEM.IND_TEMP_DAILY_O ON SYSTEM.TEMP_EMP_ATTENDANCE (EAE_EM_ID, CM_CODE, EAE_DATE)
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
MAXEXTENTS UNLIMITED
)
LOGGING;
答案 0 :(得分:0)
首先,使用“SYSTEM”用户帐户来设置用户数据并在SYSTEM表空间上创建表是一个糟糕的设计。您应该有另一个用户应该在不同的表空间上拥有您的对象。您不应该在“SYSTEM TABLESPACE”上保留任何用户数据。
现在要快速执行查询,需要考虑几个参数。
首先:
检查您是否更新了表和索引的统计信息。如果您的统计数据是陈旧的,那么这可能是主要原因,因此更新表格中的统计数据。如果统计数据不是陈旧的,那么请检查此表的last_analyzed。如果自上次分析后该表中的数据变化超过~10%,则收集统计数据。
检查该表上是否有高碎片。如果是,那么考虑重建它。
如果您的表格规模非常大,请尝试在该表格上实施分区概念。
在报表运行时检查操作系统资源利用率。你有足够的RAM,CPU来满足你的查询需求。 (free -m,vmstat 1 10,iostat -c 1 10)
AWR报告最好分析您的数据库发生了什么。当您开始生成报告记录时,然后一旦完成,请记下停机时间并生成AWR报告。如果持续时间超过1小时,则生成AWR 1小时间隔。您可以轻松找出数据库发生的情况。
这些是任何人都可以遵循的通用方法。仍然有很多参数可以从AWR报告中获取。