Max and delete statment talking lot of time [message #503457] |
Fri, 15 April 2011 17:22 |
|
Hi ALl,
Test1 table have around 385772300 rows. below delete and select statment talking lot of time.
Select stament taking more than 1 hrs.
SELECT TO_NUMBER(MAX(f.T3))
--INTO v_FISCAL_MONTH_ID
FROM Test1 f;
delete statment taking more than 2 hours
DELETE FROM TEST1 WHERE TRUNC(T10) < TRUNC(ADD_MONTHS(SYSDATE,-36));
CREATE TABLE Test1
(
T1 NUMBER NOT NULL,
T2 VARCHAR2 (7 BYTE) NOT NULL,
T3 VARCHAR2 (6 BYTE) NOT NULL,
T4 NUMBER NOT NULL,
T5 NUMBER (15, 2),
T6 NUMBER (15, 2),
T7 VARCHAR2 (20 BYTE) NOT NULL,
T8 VARCHAR2 (20 BYTE),
T9 DATE NOT NULL,
T10 DATE,
T11 NUMBER (15, 2)
)
CREATE UNIQUE INDEX TEST1_PK ON TEST1
(T1, T2, T3);
ALTER TABLE TEST1 ADD (
CONSTRAINT TEST1_PK
PRIMARY KEY
(T1, T2, T3)
);
Can you please advice something on this.
Thanks,
Sagar
CM: rearranged code tags
[Updated on: Sat, 16 April 2011 04:00] by Moderator Report message to a moderator
|
|
|
|
|
|
|