This query generates a large number of time segments (26G), as shown in the SQL plan, and the query is designed to run for more than 30 hours. Therefore, you get ORA-04031 at runtime.
These are my good recommendations.
, , , .
- , literal bind. PL/SQL . SYSDATE . ( ).
, Oracle rowid , rowid (s). - ( autotrace ).
, , - ( , ):
delete from TABLE1 t1_1
where C3_Date < :upper_date_bound
and C3_Date >= :lower_date_threshold
and (C1_Varchar2, C2_Varchar2, C3_Date) not in
(select C1_Varchar2, C2_Varchar2, max(C3_Date)
from table1 t1_2
where C3_Date < :upper_date_bound
and C3_Date >= :lower_date_bound
group by C1_Varchar2, C2_Varchar2)
- , , "IN" "EXISTS" "NOT IN". , C3_Date,
...
exists (select null from table1 t1_2
where t1_2.C1_Varchar2 = t1_1.C1_Varchar2
and t1_2.C2_Varchar2 = t1_1.C2_Varchar2
and t1_2.C3_Date = t1_1.C3_Date
and t1_2.C3_Date < :upper_date_bound
and t1_2.C3_Date >= :lower_date_bound
group by t1_2.C1_Varchar2, t1_2.C2_Varchar2
having t1_1.C3_Date < max(t1_2.C3_Date))
-