M
M
ma232021-12-02 21:52:38
Oracle
ma23, 2021-12-02 21:52:38

How to speed up table creation in ORACLE?

Good afternoon!
I'm trying to create a table, the code is as follows:

create table TAB_TMP 
as
with date as
(select 
    trunc(sysdate) - level as d
    from dual
        where to_char(trunc(sysdate)-level,'d')='7'
            or level = 1
            or (trunc(sysdate)-level)=last_day(trunc(sysdate)-level)
       connect by trunc(sysdate)-level >=
            (select min(end_date) from TABLE1)
)
select d "DATE",
    c.code "CODE",
    a.id "ID",
    a.amt "BALANCE"
from TABLE1 a
join dates b
    on b.d between a.start_date and a.end_date
join TABLE2 c
    on c.idx=a.idx


The problem is that the table is very large, the code takes too long, is there any way to optimize and speed up the process?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question